# New Ticket Created by  Patrick R. Michaud 
# Please include the string:  [perl #54520]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=54520 >


Methods defined in superclasses of PMCs aren't inherited by
PIR subclasses.  For example, suppose A and B are PMC classes,
with B extending A.  If in PIR we create a subclass of B, then
B's methods will appear in the subclass but A's methods will not.

Here's a test script to illustrate (in this example, String 
is a PMC class and CodeString is a PMC class that extends String):

$ cat x.pir
.sub main :main
    ##  check that 'to_int' method works for String
    $P0 = new 'String'
    $P0 = '01010000'
    say $P0
    $P1 = $P0.'to_int'(2)
    say $P1

    ##  check that 'to_int' method works for PIR subclass of String
    $P99 = subclass 'String', 'MyString'
    $P0 = new 'MyString'
    $P0 = '01010001'
    say $P0
    $P1 = $P0.'to_int'(2)
    say $P1

    ##  check that 'to_int' method works for CodeString (extends String)
    $P0 = new 'CodeString'
    $P0 = '01010010'
    say $P0
    $P1 = $P0.'to_int'(2)
    say $P1

    ##  check that 'to_int' method works for PIR subclass of CodeString
    $P99 = subclass 'CodeString', 'MyCodeString'
    $P0 = new 'MyCodeString'
    $P0 = '01010011'
    say $P0
    $P1 = $P0.'to_int'(2)
    say $P1
.end
$ ./parrot x.pir
01010000
80
01010001
81
01010010
82
01010011
Method 'to_int' not found for invocant of class 'MyCodeString'
current instr.: 'main' pc 153 (x.pir:29)
$


Pm

Reply via email to