Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

Parameterizing a role via a variable results in an LTA error #5211

Open p6rt opened 8 years ago

p6rt commented 8 years ago

Migrated from rt.perl.org#127832 (status was 'new')

Searchable as RT127832$

p6rt commented 8 years ago

From @hoelzro

See the attached file. If you store a parameterized role in a variable and attempt to parameterize it via postcircumfix​:sym\<[ ]>, you get a cryptic error message​:

No appropriate parametric role variant available for 'R' in any specialize at gen/moar/m-Metamodel.nqp line 2609 in any compose at gen/moar/m-Metamodel.nqp line 2988 in any make_pun at gen/moar/m-Metamodel.nqp line 1692 in any find_method at gen/moar/m-Metamodel.nqp line 1720 in block \ at test.pl line 11

p6rt commented 8 years ago

From @hoelzro

test.pl

p6rt commented 8 years ago

From @zoffixznet

Still present​:

zoffix@​VirtualBox​:/tmp/tmp.9WzczD5eHY$ perl6 -v This is Rakudo version 2016.06-154-g55c359e built on MoarVM version 2016.06-9-g8fc21d5 implementing Perl 6.c. zoffix@​VirtualBox​:/tmp/tmp.9WzczD5eHY$ 6f foo.p6 No appropriate parametric role variant available for 'R'   in any specialize at gen/moar/m-Metamodel.nqp line 2614   in any compose at gen/moar/m-Metamodel.nqp line 2993   in any make_pun at gen/moar/m-Metamodel.nqp line 1701   in any find_method at gen/moar/m-Metamodel.nqp line 1729   in block \ at foo.p6 line 10

usev6 commented 1 year ago

For the record (and to have all the data available in this issue): This is the content of the file test.pl:

use v6;

role R[$value] {}

class C {}

my $obj = C.new;
my $r = R;

$obj but $r[1];

=output
No appropriate parametric role variant available for 'R'
  in any specialize at gen/moar/m-Metamodel.nqp line 2609
  in any compose at gen/moar/m-Metamodel.nqp line 2988
  in any make_pun at gen/moar/m-Metamodel.nqp line 1692
  in any find_method at gen/moar/m-Metamodel.nqp line 1720
  in block <unit> at test.pl line 11

The code still dies nowadays:

$ ./rakudo-m -e 'role R[$value] {}; class C {}; my $obj = C.new; my $r = R; $obj but $r[1]'
No appropriate parametric role variant available for 'R':
    Cannot resolve caller (R); none of these signatures matches:
        (::$?CLASS ::::?CLASS Mu, Mu $value)
  in block <unit> at -e line 1