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
coercions don't ensure result type #5567
Comments
From zefram@fysh.orgThe description of coercion in S02 says: # The type outside the parens indicates the desired end result, and Rakudo does not actually ensure that the result of a coercion is of the
Here the sub's $a is supposedly guaranteed to be an Int, but it's actually
The value received in $a here is apparently a Rational[Num,Int], and it Because coercion methods are identified by the name of the target type, -zefram |
From @skidsOn Sun, 14 Aug 2016 08:01:48 -0700, zefram@fysh.org wrote:
Just a thought: we cannot avoid runtime checks when the argument can be |
The RT System itself - Status changed from 'new' to 'open' |
The examples from the bug report are working now:
If I'm not mistaken coercions do ensure the result type now. This has been fixed by @vrurg in the context of Raku/problem-solving#227. Again if I'm not mistaken there is already a test in roast for (a variation of) the first example. It has been unfudged with Raku/roast@4718d3e1ef#diff-0068e381348d099424e5f745766eed92d86f3a80fa42025cb5247e052e348238L38-R38 . I'd expect that there is a test for (a variation of) the second example, too -- but I didn't see it at a cursory glance. Would require a closer look with a fresh brain. Nevertheless I'd think it make sense to add the above examples as regression tests somewhere in |
Migrated from rt.perl.org#128927 (status was 'open')
Searchable as RT128927$
The text was updated successfully, but these errors were encountered: