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 dies when PIR-compiling a module that depends on a module with undeclared barewords #656

Closed
p6rt opened this issue Jan 26, 2009 · 9 comments

Comments

@p6rt
Copy link

p6rt commented Jan 26, 2009

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

Searchable as RT62768$

@p6rt
Copy link
Author

p6rt commented Jan 26, 2009

From @masak

Rakudo r35994 seems mightly confused about whether to compile a module
containing a bareword that hasn't been declared, and whether to
compile modules that depend on such a module.

$ cat A.pm
use B;
$ cat B.pm
class B does C;
$ $PARROT_DIR/parrot $PARROT_DIR/languages/perl6/perl6.pbc
--target=pir --output=B.pir B.pm
$ $PARROT_DIR/parrot $PARROT_DIR/languages/perl6/perl6.pbc
--target=pir --output=A.pir A.pm
Null PMC access in find_method()
[...]

There are two things wrong with the above. First B.pm shouldn't
compile. Second, A.pm shouldn't compile less often than B.pm does.

Note that running either A.pm or B.pm also produces the same Null PMC
access. Please fix that too.

@p6rt
Copy link
Author

p6rt commented Jan 29, 2009

From @masak

$ cat A.pm
use v6;
use B;

class A does C {
}
$ cat B.pm
use v6;
use C;
$ cat C.pm
use v6;

role C {
}
$ perl6 A.pm # works

I've encountered cases where this fails during PIR compilation, but I
am unable to reproduce them right now. AFAIU, it should fail always.

@p6rt
Copy link
Author

p6rt commented Jan 30, 2009

From @masak

masak (>)​:

$ cat A.pm
use v6;
use B;

class A does C {
}
$ cat B.pm
use v6;
use C;
$ cat C.pm
use v6;

role C {
}
$ perl6 A.pm # works

I've encountered cases where this fails during PIR compilation, but I
am unable to reproduce them right now. AFAIU, it should fail always.

This bug is, as jnthn++ pointed out over IRC, largely bogus. An
indirectly declared C should be visible in A, so the above code should
never fail, not always as I claimed.

The failure during PIR compilation turned out to be due to an undeclared
identifier 'B'.

$ cat A.pm
use v6;

class A {
  has B $!b;
}
$ cat A/B.pm
use v6;
use A;

class A​::B is A {
}
$ perl6 --target=pir --output=A.pir A.pm
$ perl6 --target=pir --output=A/B.pir A/B.pm
Lexical 'self' not found
[...]

But that makes this bug a variant of #​67268. Marking it as such.

@p6rt
Copy link
Author

p6rt commented Jan 30, 2009

@masak - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jan 30, 2009

From @masak

masak (>)​:

But that makes this bug a variant of #​67268

Oops, mean #​62768, of course.

@p6rt
Copy link
Author

p6rt commented Jan 30, 2009

@masak - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Feb 11, 2009

From @jnthn

On Fri Jan 30 01​:29​:38 2009, masak wrote​:

The failure during PIR compilation turned out to be due to an undeclared
identifier 'B'.

$ cat A.pm
use v6;

class A {
has B $!b;
}
$ cat A/B.pm
use v6;
use A;

class A​::B is A {
}
$ perl6 --target=pir --output=A.pir A.pm
$ perl6 --target=pir --output=A/B.pir A/B.pm
Lexical 'self' not found
[...]

But that makes this bug a variant of #​67268. Marking it as such.

Actually you don't need anything fancy to re-produce this, just​:

class A { has B $.x }

In the REPL does it.

Jonathan

@p6rt
Copy link
Author

p6rt commented Feb 11, 2009

From @jnthn

On Wed Feb 11 05​:15​:12 2009, jnthn@​jnthn.net wrote​:

On Fri Jan 30 01​:29​:38 2009, masak wrote​:

The failure during PIR compilation turned out to be due to an undeclared
identifier 'B'.

$ cat A.pm
use v6;

class A {
has B $!b;
}
$ cat A/B.pm
use v6;
use A;

class A​::B is A {
}
$ perl6 --target=pir --output=A.pir A.pm
$ perl6 --target=pir --output=A/B.pir A/B.pm
Lexical 'self' not found
[...]

But that makes this bug a variant of #​67268. Marking it as such.

Actually you don't need anything fancy to re-produce this, just​:

class A { has B $.x }

In the REPL does it.

And that now reports a "Malformed declaration" at compile time,
following STD.pm's lead (though we can't say it's a my or has
declaration yet, but I've put in a comment noting the difference).

So, fixed in git fba805c.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Feb 11, 2009

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

@p6rt p6rt closed this as completed Feb 11, 2009
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