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

names starting with 'q' confuse Rakudo, instead of being parsed as sub names #1680

Closed
p6rt opened this issue Apr 11, 2010 · 8 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Apr 11, 2010

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

Searchable as RT74276$

@p6rt
Copy link
Author

p6rt commented Apr 11, 2010

From @moritz

11​:57 < sundar> It seems quit is recognized as something special, given it
  didn't say "Could not find sub &quit" like it does for
other
  random words...
11​:59 < sundar> anything that starts with 'q' makes it confused instead of
  getting treated as a sub call...
12​:00 <@​moritz_> ah
12​:00 <@​moritz_> quote parsing fail
12​:00 <@​moritz_> rakudo​: qfoo
12​:00 <+p6eval> rakudo c99eeb​: OUTPUT«Confused at line 11, near
"qfoo"␤current
  instr.​: 'perl6;HLL;Grammar;panic' pc 500
  (ext/nqp-rx/src/stage0/HLL-s0.pir​:328)␤»
12​:00 <@​moritz_> rakudo​: afoo
12​:00 <+p6eval> rakudo c99eeb​: OUTPUT«Could not find sub &afoo␤current
instr.​:
  '_block14' pc 29 (EVAL_1​:0)␤»
12​:00 <@​moritz_> that's a bug
12​:00 * moritz_ submits
12​:00 <@​moritz_> hm
12​:00 <@​moritz_> std​: qfoo
12​:00 <+p6eval> std 30362​: OUTPUT«===SORRY!===␤Undeclared routine​:␤
'qfoo'
  used at line 1␤Check failed␤FAILED 00​:01 108m␤»

@p6rt
Copy link
Author

p6rt commented Apr 13, 2010

From @masak

<masak> std​: subset Quad of Any; sub classify($_) { when Quad {}; when Quad {} }
<p6eval> std 30383​: OUTPUT«ok 00​:01 110m␤»
<masak> rakudo​: subset Quad of Any; sub classify($_) { when Quad {};
when Quad {} }; say 'alive'
<p6eval> rakudo cb4521​: OUTPUT«Unable to parse blockoid, couldn't find
final '}' [...]
<masak> rakudo​: subset B of Any; sub classify($_) { when B {}; when B
{} }; say 'alive'
<p6eval> rakudo cb4521​: OUTPUT«alive␤»
* masak confused
* masak submits rakudobug

I, um... what?

@p6rt
Copy link
Author

p6rt commented Apr 13, 2010

From sundaryourfriend@gmail.com

On Tue Apr 13 06​:18​:16 2010, masak wrote​:

<masak> std​: subset Quad of Any; sub classify($_) { when Quad {}; when
Quad {} }
<p6eval> std 30383​: OUTPUT«ok 00​:01 110m␤»
<masak> rakudo​: subset Quad of Any; sub classify($_) { when Quad {};
when Quad {} }; say 'alive'
<p6eval> rakudo cb4521​: OUTPUT«Unable to parse blockoid, couldn't find
final '}' [...]
<masak> rakudo​: subset B of Any; sub classify($_) { when B {}; when B
{} }; say 'alive'
<p6eval> rakudo cb4521​: OUTPUT«alive␤»
* masak confused
* masak submits rakudobug

I, um... what?

This seems to happen with the usage of anything that starts with Q or q.
The declaration parses fine, it's when we try to use it that Rakudo gets
confused.

<sundar> rakudo​: class Mill {}; my $a = Mill.new();
<p6eval> rakudo 3b5a79​: ( no output )
<sundar> rakudo​: class Quill {}; my $a = Quill.new();
<p6eval> rakudo 3b5a79​: OUTPUT«Confused at line 11, near "my $a =
Qu"â�¤current instr.​: 'perl6;HLL;Grammar;panic' pc 500
(ext/nqp-rx/src/stage0/HLL-s0.pir​:328)â�¤Â»

<sundar> rakudo​: sub mill {say "OH HAI"}; mill;
<p6eval> rakudo 3b5a79​: OUTPUT«OH HAIâ�¤Â»
<sundar> rakudo​: sub quill {say "OH HAI"}; quill;
<p6eval> rakudo 3b5a79​: OUTPUT«Confused at line 11, near
"quill;"â�¤current instr.​: 'perl6;HLL;Grammar;panic' pc 500
(ext/nqp-rx/src/stage0/HLL-s0.pir​:328)â�¤Â»

Curiously, the sub works if we call it with parenthesis.

<sundar> rakudo​: sub quill {say "OH HAI"}; quill();
<p6eval> rakudo 3b5a79​: OUTPUT«OH HAIâ�¤Â»

@p6rt
Copy link
Author

p6rt commented Apr 13, 2010

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

@p6rt
Copy link
Author

p6rt commented May 2, 2010

From arnsholt@gmail.com

This is either an NQP bug, or an identical bug as one in NQP. I'm
looking into it. It looks like quote_EXPR somehow blocks Quad from
being parsed as an identifier.

@p6rt
Copy link
Author

p6rt commented Jul 19, 2010

From @pmichaud

Now fixed in cd2d123. Assigning to moritz for spectest verification.

Pm

@p6rt
Copy link
Author

p6rt commented Jul 19, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S02-names_and_variables/names.t

commit 6d7027ab9bb8b4a6c73582569e1d2732dbe4d723
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Mon Jul 19 21​:10​:30 2010 +0000

  [t/spec] test for RT #​74276, names starting with Q
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31770 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S02-names_and_variables/names.t b/t/spec/S02-names_and_variables/names.t
index 2b4bdac..b72580e 100644
--- a/t/spec/S02-names_and_variables/names.t
+++ b/t/spec/S02-names_and_variables/names.t
@@ -2,7 +2,7 @@ use v6;
 
 use Test;
 
-plan 22;
+plan 23;
 
 # I'm using semi-random nouns for variable names since I'm tired of foo/bar/baz and alpha/beta/...
 
@@ -77,4 +77,11 @@ plan 22;
         'error message mentions name not recognized, no maximum recursion depth exceeded';
 }
 
+# RT #74276
+# Rakudo had troubles with names starting with Q
+{
+    eval_lives_ok 'class Quox { }; Quox.new', 'class names can start with Q';
+
+}
+
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Jul 19, 2010

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

@p6rt p6rt closed this as completed Jul 19, 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant