Navigation Menu

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

Referring to non-existent captures causes Null PMC Access #1378

Closed
p6rt opened this issue Oct 25, 2009 · 9 comments
Closed

Referring to non-existent captures causes Null PMC Access #1378

p6rt opened this issue Oct 25, 2009 · 9 comments

Comments

@p6rt
Copy link

p6rt commented Oct 25, 2009

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

Searchable as RT70007$

@p6rt
Copy link
Author

p6rt commented Oct 25, 2009

From @moritz

16​:06 <@​moritz_> rakudo​: say 'aa' ~~ /(.)$1/; say $0.to
16​:06 <+p6eval> rakudo 49e62f​: OUTPUT«Null PMC access in get_string()?in
Main
  (file src/gen_setting.pm, line 295)?»

$1 doesn't exist, but this is clearly a less-than-awesome error message.

@p6rt
Copy link
Author

p6rt commented Oct 26, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S05-match/capturing-contexts.t

commit a79f9bc01be3c4fec98a41dd8e8c497783bc2ee2
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Mon Oct 26 16​:58​:07 2009 +0000

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

Inline Patch
diff --git a/t/spec/S05-match/capturing-contexts.t b/t/spec/S05-match/capturing-contexts.t
index a7279ec..b0ef110 100644
--- a/t/spec/S05-match/capturing-contexts.t
+++ b/t/spec/S05-match/capturing-contexts.t
@@ -1,8 +1,8 @@
 use v6;
-
 use Test;
-
-plan 21;
+BEGIN { @*INC.push('t/spec/packages/') };
+use Test::Util;
+plan *;
 
 if !eval('("a" ~~ /a/)') {
   skip_rest "skipped tests - rules support appears to be missing";
@@ -81,4 +81,17 @@ if !eval('("a" ~~ /a/)') {
        'Match coerced to Hash says match exists';
 }
 
+#?rakudo skip 'RT 70007'
+nok 'aa' ~~ /(.)$1/, 'match with non-existent capture does not match';
+#?rakudo todo 'RT 70007'
+is_run( q{'aa' ~~ /(.)$1/},
+        {
+            status => 0,
+            out    => '',
+            err    => rx/\S/,
+        },
+        'match with non-existent capture emits a warning' );
+
+done_testing;
+
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Oct 26, 2009

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

@p6rt
Copy link
Author

p6rt commented Oct 26, 2009

From @kyleha

I wrote the test based on the discussion that starts here​:

http://irclog.perlgeek.de/perl6/2009-10-26#i_1645351

@p6rt
Copy link
Author

p6rt commented Aug 8, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S05-match/capturing-contexts.t

commit 44dda9c33b4a3c31e60802a492ffb8ed97ccacde
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sun Aug 8 14​:54​:53 2010 +0000

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

Inline Patch
diff --git a/t/spec/S05-match/capturing-contexts.t b/t/spec/S05-match/capturing-contexts.t
index 81683cc..a68e122 100644
--- a/t/spec/S05-match/capturing-contexts.t
+++ b/t/spec/S05-match/capturing-contexts.t
@@ -100,10 +100,10 @@ is_run( q{'aa' ~~ /(.)$1/},
 }
 
 # RT #70003
+#?rakudo skip 'RT 70003'
 {
-    'a' ~~ /a/;
-    #?rakudo skip 'RT 70003'
-    is ($/.orig).rindex('a'), 0, 'rindex() works on $/.orig';
+    is ($/.orig).rindex('a'), 1, 'rindex() works on $/.orig';
+    is ($/.orig).rindex('a', 2), 1, 'rindex() works on $/.orig';
 }
 
 done_testing;

@p6rt
Copy link
Author

p6rt commented Oct 3, 2011

From @coke

On Sun Oct 25 08​:08​:11 2009, moritz wrote​:

16​:06 <@​moritz_> rakudo​: say 'aa' ~~ /(.)$1/; say $0.to
16​:06 <+p6eval> rakudo 49e62f​: OUTPUT�Null PMC access in
get_string()?in
Main
(file src/gen_setting.pm, line 295)?�

$1 doesn't exist, but this is clearly a less-than-awesome error
message.

14​:40 < [Coke]> rakudo​: say 'aa' ~~ /(.)$1/; say $0.to
14​:40 <+p6eval> rakudo 356fe7​: OUTPUT«=> <a>␤ 0 => <a>␤␤1␤»

I think the tests described later in the ticket were assuming this
should error, when it's matching now; So I'll just note the change in
behavior and let someone else figure out what's right.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jan 13, 2012

From @jnthn

On Mon Oct 03 11​:42​:07 2011, coke wrote​:

On Sun Oct 25 08​:08​:11 2009, moritz wrote​:

16​:06 <@​moritz_> rakudo​: say 'aa' ~~ /(.)$1/; say $0.to
16​:06 <+p6eval> rakudo 49e62f​: OUTPUT�Null PMC access in
get_string()?in
Main
(file src/gen_setting.pm, line 295)?�

$1 doesn't exist, but this is clearly a less-than-awesome error
message.

14​:40 < [Coke]> rakudo​: say 'aa' ~~ /(.)$1/; say $0.to
14​:40 <+p6eval> rakudo 356fe7​: OUTPUT«=> <a>␤ 0 => <a>␤␤1␤»

I think the tests described later in the ticket were assuming this
should error, when it's matching now; So I'll just note the change in
behavior and let someone else figure out what's right.

It fails to match and so errors as expected now​:

say 'aa' ~~ /(.)$1/; say $0.to
#<failed match>
Method 'to' not found for invocant of class 'Any'

Tagging testneeded.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Jan 13, 2012

From @moritz

Tested in S05-mass/rx.t.

@p6rt
Copy link
Author

p6rt commented Jan 13, 2012

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

@p6rt p6rt closed this as completed Jan 13, 2012
@p6rt p6rt added the testneeded label Jan 5, 2020
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