evalEmpire/method-signatures — pull request #103 by schwern (2014-07-30 00:03:35+00:00)
Title: Type check *after* the default is applied.  For #102

Types were checked before defaults were applied which worked when
defaults could only apply to arguments that weren't passed in. Now that
we have the where clause (and the //= shortcut) you can pass in a value
and still get a default.

func hi( Str $place //= "World" ) { print "Hi, $place!\n" }
hi(); # works
hi(undef); # the 'place' parameter (undef) is not of type Str

This patch fixes that. Type checks are done after defaults are
applied, and args with defaults are now always type checked.

Another consequence is defaults are now type checked. This will now fail.
Object $thing = "string"
This could maybe be optimized by type checking the default once
at compile time.

For #102