Still reproducible (2017.11,HEAD(e5b660e)) On 2015-09-19 11:15:43, zef...@fysh.org wrote: > A coercive type constraint is not permitted on a variable: > > $ ./perl6 -e 'my Int() $a; say 1' > ===SORRY!=== Error while compiling -e > Coercion Int(Any) is insufficiently type-like to qualify a variable > at -e:1 > ------> my Int() $a^; say 1 > expecting any of: > constraint > > But it *is* accepted if expressed in "of" form: > > $ ./perl6 -e 'my $a of Int(); say 1' > 1 > > But it doesn't actually work: > > $ ./perl6 -e 'my $a of Int(); $a = 3; say $a' > Type check failed in assignment to '$a'; expected 'Int(Any)' but got 'Int' > in block <unit> at -e:1 > > Presumably it should be forbidden in the "of" form just as it is forbidden > in the prefix form. > > -zefram
[perl #126111] [BUG] coercive type constraint for variable inconsistently accepted
Aleks-Daniel Jakimenko-Aleksejev via RT Sat, 02 Dec 2017 20:37:26 -0800