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

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

Severity: (no value)
Tag:
  • Bug
  • testcommitted
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␤␤»
Download (untitled) / with headers
text/plain 114b
Partially fixed already. I believe the fix for https://github.com/rakudo/rakudo/issues/1361 will fix this bug too.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 328b
https://github.com/rakudo/rakudo/issues/1361 has been fixed back in February 2018. All three code snippets from this issue are failing with X::Syntax::Variable::BadType now. I've added a test to S12-coercion/coercion-types.t with commit https://github.com/perl6/roast/commit/7fcc804bb9. I'm closing this ticket as 'resolved'.


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