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

Rakudo chokes in the wrong way when the name of a type is used before it's declared #905

Closed
p6rt opened this issue Apr 18, 2009 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Apr 18, 2009

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

Searchable as RT64828$

@p6rt
Copy link
Author

p6rt commented Apr 18, 2009

From @masak

<masak> rakudo​: say B; grammar B {}
<p6eval> rakudo bbd14b​: OUTPUT«invoke() not implemented in class 'Capture
* masak submits rakudobug

Same symptom when we declare a class or role. When we declare a
package or a module, or declare a type B​::C, we get the error
"invoke() not implemented in class 'NameSpace'" instead.

@p6rt
Copy link
Author

p6rt commented Aug 3, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S10-packages/basic.t

commit d756d92e13c3450abb5caf40b3c0aab251a9bbf4
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Mon Aug 3 02​:44​:59 2009 +0000

  [t/spec] Tests for RT #​64828
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;27860 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S10-packages/basic.t b/t/spec/S10-packages/basic.t
index 9fe31ed..15c6d21 100644
--- a/t/spec/S10-packages/basic.t
+++ b/t/spec/S10-packages/basic.t
@@ -4,7 +4,7 @@ use v6;
 
 use Test;
 
-plan 32;
+plan 42;
 
 regex fairly_conclusive_platform_error {:i ^\N*<<Null?>>}
 
@@ -76,6 +76,34 @@ lives_ok {package A1 { role B1 {}; class C1 does A1::B1 {}} },
         'since role is in package should not need package name';
 }
 
+{
+    my $x;
+
+    eval '$x = RT64828g; grammar RT64828g {}';
+    ok  $!  ~~ Exception, 'reference to grammar before definition dies';
+    #?rakudo todo 'RT #64828'
+    ok "$!" ~~ / RT64828g /, 'error message mentions the undefined grammar';
+
+    eval '$x = RT64828m; module RT64828m {}';
+    ok  $!  ~~ Exception, 'reference to module before definition dies';
+    #?rakudo todo 'RT #64828'
+    ok "$!" ~~ / RT64828m /, 'error message mentions the undefined module';
+
+    eval '$x = RT64828r; role RT64828r {}';
+    ok  $!  ~~ Exception, 'reference to role before definition dies';
+    #?rakudo todo 'RT #64828'
+    ok "$!" ~~ / RT64828r /, 'error message mentions the undefined role';
+
+    eval '$x = RT64828c; class RT64828c {}';
+    ok  $!  ~~ Exception, 'reference to class before definition dies';
+    ok "$!" ~~ / RT64828c /, 'error message mentions the undefined class';
+
+    eval '$x = RT64828p; package RT64828p {}';
+    ok  $!  ~~ Exception, 'reference to package before definition dies';
+    #?rakudo todo 'RT #64828'
+    ok "$!" ~~ / RT64828p /, 'error message mentions the undefined package';
+}
+
 #?rakudo todo 'ticket based on class(es) not package; RT #65022'
 {
     eval_lives_ok '{

@p6rt
Copy link
Author

p6rt commented Aug 3, 2009

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

@p6rt
Copy link
Author

p6rt commented Apr 2, 2010

From @jnthn

On Sat Apr 18 08​:48​:15 2009, masak wrote​:

<masak> rakudo​: say B; grammar B {}
<p6eval> rakudo bbd14b​: OUTPUT«invoke() not implemented in class 'Capture
* masak submits rakudobug

Same symptom when we declare a class or role. When we declare a
package or a module, or declare a type B​::C, we get the error
"invoke() not implemented in class 'NameSpace'" instead.

Now more helpful, and the tests are passed that were added to this
ticket, so closing it.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Apr 2, 2010

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

@p6rt p6rt closed this as completed Apr 2, 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