Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
return type constraints match undefined values
  • Loading branch information
gfldex committed Jun 18, 2016
1 parent 1d028e1 commit be9b155
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions doc/Type/Signature.pod
Expand Up @@ -195,10 +195,13 @@ the signature after the argument name.
The token C<-->> followed by a type will force a type check on successful
execution of a routine. The return type arrow has to be placed at the end of
the parameter list. The keyword C<returns> following a signature declaration
has the same function. C<Nil> is considered as being defined for the type check.
has the same function. C<Nil> is considered as being defined for the type
check. Type objects and thus undefined values will pass the test unless the
type smiley C<:D> is used.
sub foo(--> Int) { 1 };
sub foo(--> Int) { my Int $i; $i };
sub foo(--> Int:D) { 1 }
sub foo() returns Int { 1 };
sub does-not-work(--> Int) { "" }; # throws X::TypeCheck::Return
Expand Down

0 comments on commit be9b155

Please sign in to comment.