Skip to content
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

Pair.perl confused by some type objects #5600

Closed
p6rt opened this issue Aug 20, 2016 · 7 comments
Closed

Pair.perl confused by some type objects #5600

p6rt opened this issue Aug 20, 2016 · 7 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 20, 2016

Migrated from rt.perl.org#129008 (status was 'resolved')

Searchable as RT129008$

@p6rt
Copy link
Author

p6rt commented Aug 20, 2016

From zefram@fysh.org

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

@p6rt
Copy link
Author

p6rt commented Sep 11, 2017

From @skids

On Fri, 19 Aug 2016 19​:00​:53 -0700, zefram@​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.

@p6rt
Copy link
Author

p6rt commented Sep 11, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 11, 2017

From zefram@fysh.org

Brian S. Julin via RT wrote​:

Fixed in 2017.6 or thereabouts.

Specifically commit c6b03c45c7173e21be6c53fc629fa27f2676c76a, dated
2017-06-15.

-zefram

@p6rt
Copy link
Author

p6rt commented Sep 11, 2017

From @skids

On Mon, 11 Sep 2017 13​:35​:54 -0700, zefram@​fysh.org wrote​:

Brian S. Julin via RT wrote​:

Fixed in 2017.6 or thereabouts.

Specifically commit c6b03c45c7173e21be6c53fc629fa27f2676c76a, dated
2017-06-15.

-zefram

Tests added in roast 9a09b4ee, resolving this ticket.

@p6rt
Copy link
Author

p6rt commented Sep 11, 2017

From @skids

On Mon, 11 Sep 2017 16​:53​:15 -0700, bri@​abrij.org wrote​:

On Mon, 11 Sep 2017 13​:35​:54 -0700, zefram@​fysh.org wrote​:

Brian S. Julin via RT wrote​:

Fixed in 2017.6 or thereabouts.

Specifically commit c6b03c45c7173e21be6c53fc629fa27f2676c76a, dated
2017-06-15.

-zefram

Tests added in roast 9a09b4ee, resolving this ticket.

ACTUALLY resolving this ticket :-)

@p6rt
Copy link
Author

p6rt commented Sep 11, 2017

@skids - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Sep 11, 2017
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant