Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to detect use of coercion on vars when smiley type constraint is used #6299

Closed
p6rt opened this issue May 31, 2017 · 5 comments
Closed

Comments

@p6rt
Copy link

p6rt commented May 31, 2017

Migrated from rt.perl.org#131414 (status was 'resolved')

Searchable as RT131414$

@p6rt
Copy link
Author

p6rt commented May 31, 2017

From @zoffixznet

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␤␤»

@p6rt
Copy link
Author

p6rt commented Jan 3, 2018

From @zoffixznet

Partially fixed already. I believe the fix for rakudo/rakudo#1361 will fix this bug too.

@p6rt
Copy link
Author

p6rt commented May 10, 2018

From @usev6

rakudo/rakudo#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 Raku/roast@7fcc804bb9.

I'm closing this ticket as 'resolved'.

1 similar comment
@p6rt
Copy link
Author

p6rt commented May 10, 2018

From @usev6

rakudo/rakudo#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 Raku/roast@7fcc804bb9.

I'm closing this ticket as 'resolved'.

@p6rt p6rt closed this as completed May 10, 2018
@p6rt
Copy link
Author

p6rt commented May 10, 2018

@usev6 - Status changed from 'new' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant