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

Creating an enum from a Hash does not work but no longer warns (enum Bits (%thing)) #5943

Closed
p6rt opened this issue Dec 29, 2016 · 6 comments
Labels
LTA Less Than Awesome; typically an error message that could be better regression Issue did not exist previously testneeded

Comments

@p6rt
Copy link

p6rt commented Dec 29, 2016

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

Searchable as RT130446$

@p6rt
Copy link
Author

p6rt commented Dec 29, 2016

From @AlexDaniel

Code​:
my %h = <a 1 b 2>; enum Bits (%h); dd Bits.enums

Result (2016.05)​:
WARNINGS for /tmp/R9MG8i4xtv​:
Useless use of %h in sink context (line 1)
Map.new(())

Result (HEAD)​:
Map.new(())

It is kinda sad that the error message is no longer there. Is there anything we can do about it?

@p6rt
Copy link
Author

p6rt commented Dec 30, 2016

From @AlexDaniel

Same thing with an array

On 2016-12-29 14​:36​:55, alex.jakimenko@​gmail.com wrote​:

Code​:
my %h = <a 1 b 2>; enum Bits (%h); dd Bits.enums

Result (2016.05)​:
WARNINGS for /tmp/R9MG8i4xtv​:
Useless use of %h in sink context (line 1)
Map.new(())

Result (HEAD)​:
Map.new(())

It is kinda sad that the error message is no longer there. Is there
anything we can do about it?

@p6rt
Copy link
Author

p6rt commented Nov 29, 2017

From @TimToady

Fixed in 754664ed54aea24f9c9162002b6e68aadd311412.
Note however, that there's a braino above, since the 'my' is initialized after the value is needed. So the fix is to warn about an empty variable, not to make it work. (It does work if you make it a constant, or put the my inside a BEGIN.)

On Thu, 29 Dec 2016 14​:36​:55 -0800, alex.jakimenko@​gmail.com wrote​:

Code​:
my %h = <a 1 b 2>; enum Bits (%h); dd Bits.enums

Result (2016.05)​:
WARNINGS for /tmp/R9MG8i4xtv​:
Useless use of %h in sink context (line 1)
Map.new(())

Result (HEAD)​:
Map.new(())

It is kinda sad that the error message is no longer there. Is there
anything we can do about it?

1 similar comment
@p6rt
Copy link
Author

p6rt commented Nov 29, 2017

From @TimToady

Fixed in 754664ed54aea24f9c9162002b6e68aadd311412.
Note however, that there's a braino above, since the 'my' is initialized after the value is needed. So the fix is to warn about an empty variable, not to make it work. (It does work if you make it a constant, or put the my inside a BEGIN.)

On Thu, 29 Dec 2016 14​:36​:55 -0800, alex.jakimenko@​gmail.com wrote​:

Code​:
my %h = <a 1 b 2>; enum Bits (%h); dd Bits.enums

Result (2016.05)​:
WARNINGS for /tmp/R9MG8i4xtv​:
Useless use of %h in sink context (line 1)
Map.new(())

Result (HEAD)​:
Map.new(())

It is kinda sad that the error message is no longer there. Is there
anything we can do about it?

@p6rt
Copy link
Author

p6rt commented Dec 12, 2017

@p6rt
Copy link
Author

p6rt commented Dec 12, 2017

@zoffixznet - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Dec 12, 2017
@p6rt p6rt added LTA Less Than Awesome; typically an error message that could be better regression Issue did not exist previously testneeded labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTA Less Than Awesome; typically an error message that could be better regression Issue did not exist previously testneeded
Projects
None yet
Development

No branches or pull requests

1 participant