Tcl Source Code

View Ticket
Login
Ticket UUID: 1a56550e961f282b52a99194a4d1c9ae1c4bc5d1
Title: Method list introspection misses mixins
Type: Bug Version: 8.6
Submitter: dkf Created on: 2017-10-18 15:53:49
Subsystem: 35. TclOO Package Assigned To: dkf
Priority: 8 Severity: Minor
Status: Closed Last Modified: 2017-10-19 09:28:53
Resolution: Fixed Closed By: dkf
    Closed on: 2017-10-19 09:28:53
Description:

If we run this code which has mixins in a superclass of the class of interest:

oo::class create C {
    method c {} {}
}

oo::class create D {
    mixin C
    method d {} {}
    unexport destroy
}

oo::class create E {
    superclass D
    method e {} {}
}

puts [info class methods E -all]
E create e1
puts [info object methods e1 -all]
We see that both of the introspectors find d and e but not c. This is not correct; the introspection should find all three.

User Comments: dkf added on 2017-10-19 09:28:53:

The traversal of the mixin links was in the wrong place relative to the tail-recursive unrolling inside AddClassMethodNames inside tclOOCall.c; the mixin would have been found if the class into which it had been mixed had two (or more) ordinary superclasses. Rearranging the code and adding a separate mechanism for determining how to avoid excess work seems to fix it.