Skip Menu |
Report information
Id: 127775
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: alex.jakimenko [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: LTA error message when trying to declare enums incorrectly (enum Foo <<:Bar(1) :Baz>>)
Download (untitled) / with headers
text/plain 211b
Code: enum Foo <<:Bar(1) :Baz>> Result: ===SORRY!=== Incompatible MROs in P6opaque rebless <jnthn> That's a crappy error :) This bug is somewhat similar to https://rt.perl.org/Ticket/Display.html?id=126987
Download (untitled) / with headers
text/plain 195b
Still present today on rakudo 89470a: <Zoffix> m: enum Foo <<:Bar(1) :Baz>> <camelia> rakudo-moar 89470a: OUTPUT«===SORRY!===␤Incompatible MROs in P6opaque rebless for types Bool and Foo␤»
Actually, it's not about the error message. The whole thing can be golfed to this:

enum Foo (:Bar(1), :Baz(True))

And the error happens because:

Code:
use nqp;
say so nqp::istype(True, Int);
nqp::rebless(True, Int)

Result:
True
Incompatible MROs in P6opaque rebless for types Bool and Int
  in block <unit> at -e line 3

Or something like that. So it is “istype” of something but you can't rebless it.

The type is checked here:
https://github.com/rakudo/rakudo/blob/de0533c4d4c9f425ce22432a8e4555ded27cba91/src/Perl6/Actions.nqp#L4621

Rebless is here:
https://github.com/rakudo/rakudo/blob/5144216f6ea723747cb25fea51f99861c1ea213a/src/Perl6/World.nqp#L3629

IRC logs:
https://irclog.perlgeek.de/perl6/2017-10-07#i_15272313
https://irclog.perlgeek.de/perl6/2017-10-08#i_15272350

I really don't know what to do about it. You cannot just .Int it because stringy enums exist (enum Foo (:Bar("foo")); say Bar). It's weird.

On 2016-07-10 07:01:59, cpan@zoffix.com wrote:
Show quoted text
> Still present today on rakudo 89470a:
>
> <Zoffix> m: enum Foo <<:Bar(1) :Baz>>
> <camelia> rakudo-moar 89470a: OUTPUT«===SORRY!===␤Incompatible MROs in
> P6opaque rebless for types Bool and Foo␤»


Zoffix++ pointed out that there is a problem with IntStr also:

Code:
enum Foo (:Bar(1), :Baz(<42>))

Result:
Show quoted text
===SORRY!===
Incompatible MROs in P6opaque rebless for types IntStr and Foo

On 2017-10-07 17:16:30, alex.jakimenko@gmail.com wrote:
Show quoted text
> Actually, it's not about the error message. The whole thing can be
> golfed to
> this:
>
> enum Foo (:Bar(1), :Baz(True))
>
> And the error happens because:
>
> Code:
> use nqp;
> say so nqp::istype(True, Int);
> nqp::rebless(True, Int)
>
> Result:
> True
> Incompatible MROs in P6opaque rebless for types Bool and Int
> in block <unit> at -e line 3
>
> Or something like that. So it is “istype” of something but you can't
> rebless
> it.
>
> The type is checked here:
> https://github.com/rakudo/rakudo/blob/de0533c4d4c9f425ce22432a8e4555ded27cba91/src/Perl6/Actions.nqp#L4621
>
> Rebless is here:
> https://github.com/rakudo/rakudo/blob/5144216f6ea723747cb25fea51f99861c1ea213a/src/Perl6/World.nqp#L3629
>
> IRC logs:
> https://irclog.perlgeek.de/perl6/2017-10-07#i_15272313
> https://irclog.perlgeek.de/perl6/2017-10-08#i_15272350
>
> I really don't know what to do about it. You cannot just .Int it
> because
> stringy enums exist (enum Foo (:Bar("foo")); say Bar). It's weird.
>
> On 2016-07-10 07:01:59, cpan@zoffix.com wrote:
> > Still present today on rakudo 89470a:
> >
> > <Zoffix> m: enum Foo <<:Bar(1) :Baz>>
> > <camelia> rakudo-moar 89470a: OUTPUT«===SORRY!===␤Incompatible MROs
> > in
> > P6opaque rebless for types Bool and Foo␤»


I am pretty sure that this commit is relevant to this issue: https://github.com/rakudo/rakudo/commit/fc52143beee3178c7f39d770f95c7d60b2a1a1e4

On 2017-10-07 17:20:37, alex.jakimenko@gmail.com wrote:
Show quoted text
> Zoffix++ pointed out that there is a problem with IntStr also:
>
> Code:
> enum Foo (:Bar(1), :Baz(<42>))
>
> Result:
> ===SORRY!===
> Incompatible MROs in P6opaque rebless for types IntStr and Foo
>
> On 2017-10-07 17:16:30, alex.jakimenko@gmail.com wrote:
> > Actually, it's not about the error message. The whole thing can be
> > golfed to
> > this:
> >
> > enum Foo (:Bar(1), :Baz(True))
> >
> > And the error happens because:
> >
> > Code:
> > use nqp;
> > say so nqp::istype(True, Int);
> > nqp::rebless(True, Int)
> >
> > Result:
> > True
> > Incompatible MROs in P6opaque rebless for types Bool and Int
> > in block <unit> at -e line 3
> >
> > Or something like that. So it is “istype” of something but you can't
> > rebless
> > it.
> >
> > The type is checked here:
> >
> https://github.com/rakudo/rakudo/blob/de0533c4d4c9f425ce22432a8e4555ded27cba91/src/Perl6/Actions.nqp#L4621
> >
> > Rebless is here:
> >
> https://github.com/rakudo/rakudo/blob/5144216f6ea723747cb25fea51f99861c1ea213a/src/Perl6/World.nqp#L3629
> >
> > IRC logs:
> > https://irclog.perlgeek.de/perl6/2017-10-07#i_15272313
> > https://irclog.perlgeek.de/perl6/2017-10-08#i_15272350
> >
> > I really don't know what to do about it. You cannot just .Int it
> > because
> > stringy enums exist (enum Foo (:Bar("foo")); say Bar). It's weird.
> >
> > On 2016-07-10 07:01:59, cpan@zoffix.com wrote:
> > > Still present today on rakudo 89470a:
> > >
> > > <Zoffix> m: enum Foo <<:Bar(1) :Baz>>
> > > <camelia> rakudo-moar 89470a: OUTPUT«===SORRY!===␤Incompatible MROs
> > > in
> > > P6opaque rebless for types Bool and Foo␤»




This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org