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

LTA error message when an enum value occurs in the signature of a routine without a closing curly brace '}' in Rakudo #4221

Closed
p6rt opened this issue May 6, 2015 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented May 6, 2015

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

Searchable as RT125120$

@p6rt
Copy link
Author

p6rt commented May 6, 2015

From @masak

<andreoss> m​: enum X<A B C>; enum Q<D E F>; multi infix​:«»(X $a, Q
$b) { True # all X match all Q }; say A ~~ F;
<camelia> rakudo-moar 176304​: OUTPUT«Error while constructing error
object​:Could not locate compile-time value for symbol
Syntax​::Missing␤===SORRY!===␤Cannot iterate object with P6str
representation␤»
<andreoss> works in REPL
<RabidGravy> not for me it doesn't
<masak> andreoss​: that '#' turns everything after it into a comment.
<masak> m​: enum X<A B C>; enum Q<D E F>; multi infix​:«
»(X $a, Q $b) { True
<camelia> rakudo-moar 176304​: OUTPUT«Error while constructing error
object​:Could not locate compile-time value for symbol
Syntax​::Missing␤===SORRY!===␤Cannot iterate object with P6str
representation␤»
<masak> same error.
<masak> (which is Less Than Awesome, granted)
* masak submits LTA rakudobug
<andreoss> m​: enum X<A B C>; enum Q<D E F>; multi infix​:«»(X $a, Q
$b) { True #`{all X match all Q} }; say A ~~ F;
<camelia> rakudo-moar 176304​: OUTPUT«False␤»
<masak> m​: sub foo { True
12​:13 <+camelia> rakudo-moar 176304​: OUTPUT«===SORRY!=== Error while
compiling /tmp/IPnz50B8lg␤Missing block [...]
<masak> hm.
<masak> m​: enum X <A>; multi infix​:«
»(X $a, X $b) { True
<camelia> rakudo-moar 176304​: OUTPUT«Error while constructing error
object​:Could not locate compile-time value for symbol
Syntax​::Missing␤===SORRY!===␤Cannot iterate object with P6str
representation␤»
<masak> heh, the enum is an irreducible part of the LTA bug. :)
<masak> m​: enum X <A>; sub foo(X $a) { True
<camelia> rakudo-moar 176304​: OUTPUT«Error while constructing error
object​:Could not locate compile-time value for symbol
Syntax​::Missing␤===SORRY!===␤Cannot iterate object with P6str
representation␤»
<masak> m​: enum X <A>; sub foo(A $a) { True
<camelia> rakudo-moar 176304​: OUTPUT«Error while constructing error
object​:Could not locate compile-time value for symbol
Syntax​::Missing␤===SORRY!===␤Cannot iterate object with P6str
representation␤»
<masak> ...and it doesn't have to be a type object (X), it can also be
an enum (A).

@p6rt
Copy link
Author

p6rt commented Jun 29, 2015

From @jnthn

On Wed May 06 06​:08​:59 2015, masak wrote​:

<andreoss> m​: enum X<A B C>; enum Q<D E F>; multi infix​:«»(X $a, Q
$b) { True # all X match all Q }; say A ~~ F;
<camelia> rakudo-moar 176304​: OUTPUT«Error while constructing error
object​:Could not locate compile-time value for symbol
Syntax​::Missing␤===SORRY!===␤Cannot iterate object with P6str
representation␤»
<andreoss> works in REPL
<RabidGravy> not for me it doesn't
<masak> andreoss​: that '#' turns everything after it into a comment.
<masak> m​: enum X<A B C>; enum Q<D E F>; multi infix​:«
»(X $a, Q $b) { True
<camelia> rakudo-moar 176304​: OUTPUT«Error while constructing error
object​:Could not locate compile-time value for symbol
Syntax​::Missing␤===SORRY!===␤Cannot iterate object with P6str
representation␤»
<masak> same error.
<masak> (which is Less Than Awesome, granted)
* masak submits LTA rakudobug
<andreoss> m​: enum X<A B C>; enum Q<D E F>; multi infix​:«»(X $a, Q
$b) { True #`{all X match all Q} }; say A ~~ F;
<camelia> rakudo-moar 176304​: OUTPUT«False␤»
<masak> m​: sub foo { True
12​:13 <+camelia> rakudo-moar 176304​: OUTPUT«===SORRY!=== Error while
compiling /tmp/IPnz50B8lg␤Missing block [...]
<masak> hm.
<masak> m​: enum X <A>; multi infix​:«
»(X $a, X $b) { True
<camelia> rakudo-moar 176304​: OUTPUT«Error while constructing error
object​:Could not locate compile-time value for symbol
Syntax​::Missing␤===SORRY!===␤Cannot iterate object with P6str
representation␤»
<masak> heh, the enum is an irreducible part of the LTA bug. :)
<masak> m​: enum X <A>; sub foo(X $a) { True
<camelia> rakudo-moar 176304​: OUTPUT«Error while constructing error
object​:Could not locate compile-time value for symbol
Syntax​::Missing␤===SORRY!===␤Cannot iterate object with P6str
representation␤»
<masak> m​: enum X <A>; sub foo(A $a) { True
<camelia> rakudo-moar 176304​: OUTPUT«Error while constructing error
object​:Could not locate compile-time value for symbol
Syntax​::Missing␤===SORRY!===␤Cannot iterate object with P6str
representation␤»
<masak> ...and it doesn't have to be a type object (X), it can also be
an enum (A).

It turns out that this is Yet Another Case of people tripping over the X namespace being the exception one, and lexically hiding the real one from the compiler by declaring their own X that. I've now made the compiler only look for the exceptions it knows about in the setting, thus making the error for this case sane again​:

$ perl6-m -e "enum X <A>; sub foo(A $a) { True"
===SORRY!=== Error while compiling -e
Missing block
at -e​:1
------> enum X <A>; sub foo(A $a) { True<HERE><EOL>

@p6rt
Copy link
Author

p6rt commented Jun 29, 2015

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

@p6rt p6rt closed this as completed Jun 29, 2015
@p6rt
Copy link
Author

p6rt commented Jun 29, 2015

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

@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