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

Q:PIR fails as last statement in a block #2523

Closed
p6rt opened this issue Oct 18, 2011 · 6 comments
Closed

Q:PIR fails as last statement in a block #2523

p6rt opened this issue Oct 18, 2011 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Oct 18, 2011

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

Searchable as RT101562$

@p6rt
Copy link
Author

p6rt commented Oct 18, 2011

From kpolulak@gmail.com

I stumbled across a bug where `perl6 --doc` fails to parse the file if it
contains inline PIR. Not just any inline PIR, only PIR that calls the
'find_lex' opcode within a method.

Consider the following code​:

  =begin pod

  Some text

  =end pod

  class Foo;

  method foobar() {
  my $string := 'Why does POD6 hate me so much?';

  Q​:PIR {
  $P0 = find_lex '$string'
  };
  }

Running `perl6 --doc` gives a lovely IMCC error​:

  Use of uninitialized value in string context
  Use of uninitialized value in string context
  ===SORRY!===
  error​:imcc​:syntax error, unexpected '\n'
  in file '(file unknown)' line 242

The "unexpected" character can vary sometimes. If I add​:

  self = new $P0

after the call to 'find_lex', I get two "unexpected" characters​:

  error​:imcc​:syntax error, unexpected '=', expecting '(' ('=')
  in file '(file unknown)' line 253
  error​:imcc​:syntax error, unexpected '\n'
  in file '(file unknown)' line 256

It's only under those conditions though​: only with the 'find_lex' opcode and
only inside a method definition. I can't understand why any non-pod text
after an `=end pod` would affect the rendering of POD.

--
- Kevin Polulak (soh_cah_toa)

@p6rt
Copy link
Author

p6rt commented Oct 19, 2011

From @cognominal

When trying to reduce
https://rt-archive.perl.org/perl6//Public/Bug/Display.html?id=101562,
I hit another(?) bug.

In rakudo nom 9c3d3d103a52b7fdaa847ae1e001229a6e841ff1

$ cat h.p6  Q​:PIR {  say 'hi'    }; $ perl6 h.p6hi$ perl6
hi.p6===SORRY!===error​:imcc​:syntax error, unexpected '\n' in file
'(file unknown)' line 237
$ cat hi.p6sub a {   Q​:PIR {  say 'hi'    }; } $$ perl6 --target=pir
hi.p6  > hi.pir; parrot hi.pirerror​:imcc​:syntax error, unexpected
'\n' in file 'hi.pir' line 258
current instr.​: '__default_get_packfile' pc 428 (frontend/parrot2/prt0.pir​:217)

Looking at hi.pir starting line 257, I see that the
perl6_decontainerize_return_value instruction is incorrect. Note the
trailing comma.

  say 'hi'
  perl6_decontainerize_return_value $P100,

According to the source in src/ops/perl6.ops it expects an argument
which is missing
  inline op perl6_decontainerize_return_value(out PMC, in PMC) :base_core {

--
cognominal stef

@p6rt
Copy link
Author

p6rt commented Oct 19, 2011

From @moritz

The problem here is that you don't return anything from Q​:PIR {} (not
assigning to %r), but you use it as the last statement in a block, which
is responsible for its return value.

The solution is simply to put another statement after it (for example 1;).

@p6rt
Copy link
Author

p6rt commented Oct 19, 2011

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

@p6rt
Copy link
Author

p6rt commented Oct 10, 2012

From @coke

On Wed Oct 19 06​:29​:49 2011, moritz wrote​:

The problem here is that you don't return anything from Q​:PIR {} (not
assigning to %r), but you use it as the last statement in a block, which
is responsible for its return value.

The solution is simply to put another statement after it (for example 1;).

Spoke with OP on #perl6 - this workaround is sufficient to close out the ticket.

Regards.
--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 10, 2012

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

@p6rt p6rt closed this as completed Oct 10, 2012
@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