As it was said before, infix:<%> now gives the same divide-by-zero errors as 
infix:</>.

In roast we currently only test with 'dies_ok' and 'eval_dies_ok'. On #perl6 it 
was pointed out by psch++ two days ago that we don't fail directly with 
X::Numeric::DivideByZero, but with X::TypeCheck::Return (or 
X::Typecheck::Assignment):

<psch> right
<psch> lazy rats or something i think
<psch> m: my $y = 3; my $x = do { CATCH { default { say .perl } }; ($y / 0).Int 
}; say $x.WHAT
<camelia> rakudo-moar a75337: OUTPUT«X::TypeCheck::Return.new(operation => 
"returning", got => Failure.new(exception => X::Numeric::DivideByZero.new(using 
=> Any)), expected => Int)␤(Any)␤»
<psch> that means the $y / 0 returns something non-Int-y, which throws 
differently, with DivideByZero as additional payload
<psch> that seems a bit convoluted
<psch> as in, i can't imagine a case where we get *just* 
X::Numeric::DivideByZero not wrapped in some X::TypeCheck

On a related note: 'say 0 / 0' fails differently than the other three:

$ perl6 -e 'my $x = do { CATCH { default { say .perl } }; ( 0 / 0 ).Int };'
X::TypeCheck::Assignment.new(symbol => "\$numerator", operation => 
"assignment", got => Failure.new(exception => 
X::Numeric::DivideByZero.new(using => Any)), expected => Int)

$ perl6 -e 'my $x = do { CATCH { default { say .perl } }; ( 1 / 0 ).Int };'
X::TypeCheck::Return.new(operation => "returning", got => Failure.new(exception 
=> X::Numeric::DivideByZero.new(using => Any)), expected => Int)

$ perl6 -e 'my $x = do { CATCH { default { say .perl } }; ( 0 % 0 ).Int };'
X::TypeCheck::Return.new(operation => "returning", got => Failure.new(exception 
=> X::Numeric::DivideByZero.new(using => "infix:<\%>")), expected => Int)

$ perl6 -e 'my $x = do { CATCH { default { say .perl } }; ( 1 % 0 ).Int };'
X::TypeCheck::Return.new(operation => "returning", got => Failure.new(exception 
=> X::Numeric::DivideByZero.new(using => "infix:<\%>")), expected => Int)

IMHO that meets the requirements of this ticket. So I'd vote for "closable 
(maybe after tweaking the tests to reflect the typed exceptions)".

Reply via email to