Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type check *after* the default is applied. For #102 #103

Merged
merged 3 commits into from Aug 6, 2014
Merged

Commits on Jul 29, 2014

  1. Type check *after* the default is applied.

    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.
    schwern committed Jul 29, 2014
    Copy the full SHA
    60b4d4a View commit details
    Browse the repository at this point in the history

Commits on Jul 30, 2014

  1. Copy the full SHA
    194f079 View commit details
    Browse the repository at this point in the history
  2. 5.8 fixed for reals this time.

    when doesn't work on 5.8 either, which is puzzling.
    schwern committed Jul 30, 2014
    Copy the full SHA
    3568a49 View commit details
    Browse the repository at this point in the history