Skip Menu |
Report information
Id: 131414
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: cpan [at] zoffix.com
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [BUG] Failure to detect use of coercion on vars when smiley type constraint is used
Download (untitled) / with headers
text/plain 945b
The first eval complains that I can't use a coercer on a variable... However, the latter ones fail to detect use of coercion and don't complain, but don't coerce either. 18:43 Zoffix m: class { has Int() $.x = '42'}.new.x 18:43 camelia rakudo-moar fb7dd8: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Coercion Int(Any) is insufficiently type-like to qualify a variable␤at <tmp>:1␤------> 3class { has Int() $.x7⏏5 = '42'}.new.x␤ expecting any of:␤ constraint␤» 18:43 Zoffix m: class { has Int:D() $.x = '42'}.new.x 18:43 camelia rakudo-moar fb7dd8: OUTPUT: «Type check failed in assignment to $!x; expected Int:D but got Str ("42")␤ in block <unit> at <tmp> line 1␤␤» 18:45 Zoffix m: class { has Int:D() $.x = 42}.new(:x('42')) 18:45 camelia rakudo-moar fb7dd8: OUTPUT: «Type check failed in assignment to $!x; expected Int:D but got Str ("42")␤ in block <unit> at <tmp> line 1␤␤»


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org