You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ 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.
On Wed, 13 Sep 2017 18:21:56 -0700, bri@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.
p6rt
added
the
LTA
Less Than Awesome; typically an error message that could be better
label
Jan 5, 2020
Migrated from rt.perl.org#132081 (status was 'new')
Searchable as RT132081$
The text was updated successfully, but these errors were encountered: