# New Ticket Created by  Zefram 
# Please include the string:  [perl #129008]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=129008 >


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

Reply via email to