On Fri, 05 Aug 2016 20:18:01 -0700, c...@zoffix.com wrote: > TimToady's comments on the matter: http://irclog.perlgeek.de/perl6- > dev/2016-08-06#i_12976358 > > I stumbled on this while examining > https://rt.perl.org/Ticket/Display.html?id=127341#ticket-history > > It seems this commit had a consequence that .Rat on an Inf or NaN does > not actually return an object that can be stored in a Rat: > https://github.com/rakudo/rakudo/commit/498d0a4ae4572a84f80c0c572632e12017d779f3 > > The issue is now there's no guarantee that a .Rat can be used as a Rat > and thus the programmer has to perform additional checks. > > Here are some examples of the issue: > > <Zoffix> m: say ∞.Rat ~~ Rat > <camelia> rakudo-moar 589061: OUTPUT«False» > <Zoffix> m: Duration.new: NaN > <camelia> rakudo-moar 589061: OUTPUT«Type check failed in assignment > to $!tai; expected Rat but got Rational[Num,Int] (?) in block <unit> > at <tmp> line 1» > <Zoffix> m: Duration.new: ∞ > <camelia> rakudo-moar 589061: OUTPUT«Type check failed in assignment > to $!tai; expected Rat but got Rational[Num,Int] (?) in block <unit> > at <tmp> line 1» > <Zoffix> m: class { has Rat $.secret-ingredient; method new ($v) { > self.bless: secret-ingredient => $v.Rat } }.new: ∞ > <camelia> rakudo-moar 589061: OUTPUT«Type check failed in assignment > to $!secret-ingredient; expected Rat but got Rational[Num,Int] (?) > in method new at <tmp> line 1 in block <unit> at <tmp> line 1» > <Zoffix> m: my Rat $x = ∞.Rat > <camelia> rakudo-moar 589061: OUTPUT«Type check failed in assignment > to $x; expected Rat but got Rational[Num,Int] (?) in block <unit> at > <tmp> line 1»
Thank you for the report. This is now fixed. Fix: https://github.com/rakudo/rakudo/commit/042cb7413f87277 Test: https://github.com/perl6/roast/commit/c3086244fd0c6feea