Skip Menu |
Report information
Id: 111912
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

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



Subject: [BUG] Composing an inherited class through a parametric role doesn't work in Rakudo
Date: Wed, 21 Mar 2012 16:32:41 +0100
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 298b
<moritz> nom: role A[::T $] { also is T }; class B { }; class C does A[B] { }; say C ~~ B <p6eval> rakudo 1a468d: OUTPUT«===SORRY!===␤Cannot type check against type variable T␤» <moritz> that's... somwhere between LTA and wrong, I'm not sure where exactly it is :-) * masak submits rakudobug
Download (untitled) / with headers
text/plain 687b
On Wed, 21 Mar 2012 08:32:55 -0700, masak wrote: Show quoted text
> <moritz> nom: role A[::T $] { also is T }; class B { }; class C does > A[B] { }; say C ~~ B > <p6eval> rakudo 1a468d: OUTPUT«===SORRY!===␤Cannot type check against > type variable T␤»
Now it throws earlier, and with a nicer error message: ===SORRY!=== Error while compiling -e T does not support inheritance, so A cannot inherit from it Not sure if it can be made to work like you wanted. Not sure if it can be made to actually work (i.e. defer the `also is T` until class composition time, at which point the concrete type of T would be available). Seems related to: https://rt.perl.org/Ticket/Display.html?id=130634


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