Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

c3 bug with ISA[i] = undef #251

@rurban

Description

@rurban

t/mro/basic.t test 26 fails with c3:

    {
        package ISACLEAR;
        our @ISA = qw/XX YY ZZ/;
    }
    # baseline
    ok(eq_array(mro::get_linear_isa('ISACLEAR'),[qw/ISACLEAR XX YY ZZ/]));

    # this looks dumb, but it preserves existing behavior for compatibility
    #  (undefined @ISA elements treated as "main")
    # This revealed a c3 bug (undetected since 2007)
    $ISACLEAR::ISA[1] = undef;
    ok(eq_array(mro::get_linear_isa('ISACLEAR'),[qw/ISACLEAR XX main ZZ/]))
      or diag "'".join("' '",@{mro::get_linear_isa('ISACLEAR')})."'";

=>
'ISACLEAR' 'XX' 'main' 'ZZ' with dfs
'ISACLEAR' 'XX' 'main' '' 'ZZ' with c3.

Note the empty entry after the inserted/changed main. YY => main.
This problem existed since 2007, the initial c3 implementation. It was never tested.

Detected by #209

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions