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

Enum name as type constraint is unreasonably strict #1788

Closed
p6rt opened this issue May 27, 2010 · 7 comments
Closed

Enum name as type constraint is unreasonably strict #1788

p6rt opened this issue May 27, 2010 · 7 comments

Comments

@p6rt
Copy link

p6rt commented May 27, 2010

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

Searchable as RT75370$

@p6rt
Copy link
Author

p6rt commented May 27, 2010

From @moritz

Not sure if this should work​:

09​:39 < isBEKaml> rakudo​: enum somenum <a b c d e>; my somenum $temp =
3; say $temp.key;
09​:39 <+p6eval> rakudo 982e8e​: OUTPUT«Type check failed for
assignment␤current instr.​: '&die' pc 18373 (src/builtins/Junction.pir​:373)␤»

But this should work for sure​:

09​:39 <@​moritz_> rakudo​: enum somenum <a b c d e>; my somenum $temp = d;
say $temp
09​:39 <+p6eval> rakudo 982e8e​: OUTPUT«Type check failed for
assignment␤current instr.​: '&die' pc 18373 (src/builtins/Junction.pir​:373)␤»

@p6rt
Copy link
Author

p6rt commented Aug 11, 2010

@coke - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 14, 2011

From @coke

On Thu May 27 00​:44​:18 2010, moritz wrote​:

Not sure if this should work​:

09​:39 < isBEKaml> rakudo​: enum somenum <a b c d e>; my somenum $temp =
3; say $temp.key;
09​:39 <+p6eval> rakudo 982e8e​: OUTPUT«Type check failed for
assignment␤current instr.​: '&die' pc 18373
(src/builtins/Junction.pir​:373)␤»

But this should work for sure​:

09​:39 <@​moritz_> rakudo​: enum somenum <a b c d e>; my somenum $temp =
d;
say $temp
09​:39 <+p6eval> rakudo 982e8e​: OUTPUT«Type check failed for
assignment␤current instr.​: '&die' pc 18373
(src/builtins/Junction.pir​:373)␤»

Still don't know if the first one should work, but the second one does
work now​:

15​:27 < [Coke]> rakudo​: enum somenum <a b c d e>; my somenum $temp = 3;
say
  $temp.key;
15​:27 <+p6eval> rakudo ce15be​: OUTPUT«Type check failed in assignment to
  '$temp'; expected 'somenum' but got 'Int'␤ in block
<anon> at
  /tmp/5fZwMAEju3​:1␤ in <anon> at /tmp/5fZwMAEju3​:1␤»
15​:27 < [Coke]> rakudo​: enum somenum <a b c d e>; my somenum $temp = d;
say
  $temp;
15​:27 <+p6eval> rakudo ce15be​: OUTPUT«somenum​::d␤»

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Feb 26, 2014

From @coke

On Fri Oct 14 12​:30​:57 2011, coke wrote​:

On Thu May 27 00​:44​:18 2010, moritz wrote​:

Not sure if this should work​:

09​:39 < isBEKaml> rakudo​: enum somenum <a b c d e>; my somenum $temp =
3; say $temp.key;
09​:39 <+p6eval> rakudo 982e8e​: OUTPUT«Type check failed for
assignment␤current instr.​: '&die' pc 18373
(src/builtins/Junction.pir​:373)␤»

But this should work for sure​:

09​:39 <@​moritz_> rakudo​: enum somenum <a b c d e>; my somenum $temp =
d;
say $temp
09​:39 <+p6eval> rakudo 982e8e​: OUTPUT«Type check failed for
assignment␤current instr.​: '&die' pc 18373
(src/builtins/Junction.pir​:373)␤»

Still don't know if the first one should work, but the second one does
work now​:

15​:27 < [Coke]> rakudo​: enum somenum <a b c d e>; my somenum $temp = 3;
say
$temp.key;
15​:27 <+p6eval> rakudo ce15be​: OUTPUT«Type check failed in assignment to
'$temp'; expected 'somenum' but got 'Int'␤ in block
<anon> at
/tmp/5fZwMAEju3​:1␤ in <anon> at /tmp/5fZwMAEju3​:1␤»
15​:27 < [Coke]> rakudo​: enum somenum <a b c d e>; my somenum $temp = d;
say
$temp;
15​:27 <+p6eval> rakudo ce15be​: OUTPUT«somenum​::d␤»

Hearing no objection, closable with tests.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Sep 30, 2014

From @usev6

stmuk added a test for this recently​: Raku/roast@b4fc0fe

I moved the test from S02-names/75370.t to S12-enums/basic.t (which is in 't/spectest.data').

1 similar comment
@p6rt
Copy link
Author

p6rt commented Sep 30, 2014

From @usev6

stmuk added a test for this recently​: Raku/roast@b4fc0fe

I moved the test from S02-names/75370.t to S12-enums/basic.t (which is in 't/spectest.data').

@p6rt
Copy link
Author

p6rt commented Sep 30, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant