On Wed, 13 Sep 2017 18:21:56 -0700, b...@abrij.org wrote:
> $ perl6 -e 'my Int $a is default("foo");'
> ===SORRY!=== Error while compiling -e
> Default value 'foo' will never bind to a parameter of type Int
> at -e:1
> ------> my Int $a is default("foo")⏏;
>     expecting any of:
>         constraint
> $ perl6 -e 'class A { has Int $.a is default("foo"); }'
> ===SORRY!=== Error while compiling -e
> Type check failed in assignment to $!a; expected Int but got Str
> ("foo")
> at -e:1
> 
> An attribute should probably throw X::Parameter::Default::TypeCheck,
> like the
> simple variable does, rather than X::TypeCheck::Assignment+{X::Comp}
> 
> I'll be adding fudged tests to S02-names/is_default for this.


The error message is also mentioned in RT#126296 as a side issue.
Also in another ticket I cannot find at the moment, where it is suggested
that neither of them are a parameter, so maybe we need new X's for each
of variable and attribute.

Reply via email to