On Fri, 19 Aug 2016 19:00:53 -0700, zef...@fysh.org wrote:
> Pair.perl produces incorrect output for some type objects:
> 
> > ((Int) => 2).perl
> Int => 2
> > ((Int) => 2).perl.EVAL.perl
> :Int(2)
> 
> Following the fix for [perl #126890] it's correct for most type
> objects:
> 
> > ((Pair) => 2).perl
> (Pair) => 2
> 
> but if given the type object for a type that .^does(Numeric) it
> mistakes
> the type object for a definite numeric value.  It follows the code
> branch
> that's intended to produce "3 => 2" rather than "(3) => 2", so it
> fails
> to parenthesise the type object name.
> 
> If the type object is Num, it gets into another special-case code
> branch:
> 
> > ((Num) => 3).perl
> Cannot unbox a type object
>   in block <unit> at <unknown file> line 1
> 
> There's a related failure resulting from mistaking the Str type object
> for a string:
> 
> > ((Str) => 2).perl
> Use of uninitialized value of type Str in string context.
> Methods .^name, .perl, .gist, or .say can be used to stringify it to
> something meaningful.  in block <unit> at <unknown file> line 1
> Str => 2
> 
> and another resulting from mistaken handling of the Bool type object
> in
> the value slot:
> 
> > :a(Bool).perl
> :!a
> 
> There needs to be some :D or equivalent on all of these type checks.
> 
> -zefram

Fixed in 2017.6 or thereabouts.  Tests needed.

Reply via email to