Extended case: if the "of" clause comes after an "is default" clause,
then the explicit default is not subjected to the type constraint.
Other behaviour remains the same.

$ ./perl6 -e 'my $a is default("foo") of Int; say $a'
foo
$ ./perl6 -e 'my $a is default("foo") of Int; $a = $a; say $a'
Type check failed in assignment to '$a'; expected 'Int' but got 'Str'
  in block <unit> at -e:1
$ ./perl6 -e 'my $a is default("foo") of Int; $a = 3; say $a; $a = Nil; say $a'
3
foo

-zefram

Reply via email to