I guess I found a bug in accessing Slots using #slots in combination with IndexedSlots and traits. To reproduce use latest Pharo 7 (Build 1126)
First create a class with a slot, note that the slot needs to be : Object subclass: #ClassA slots: { IndexedSlot named: #upper } classVariables: { } package: 'Slot-Bugs' As it is the first slot it internally receives an index 1 as you can check with "ClassA slots first". Now define a stateful trait with another indexed slot: Trait named: #StatefulTrait uses: {} slots: { IndexedSlot named: #slotFromTrait } category: 'Slot-Bugs' And create a new subclass using the new Trait ClassA subclass: #ClassB uses: StatefulTrait instanceVariableNames: '' classVariableNames: '' package: 'Slot-Bugs' 1. when you evaluate "ClassA slots" it returns {#FirstSlot => Slot} which is correct 2. when you evaluate "StatefulTrait slots" it returns {#slotFromTrait => Slot} which is correct 3. when you evaluate "ClassB allSlots" returns "an OrderedCollection(#upper => InstanceVariableSlot #slotFromTrait => InstanceVariableSlot)" which is OK but 4. when you evaluate "ClassB slots" it returns {#slotFromTrait => InstanceVariableSlot} which is NOT correct as class B does not define the slot, it is defined in the trait So I think 4. is wrong and reasons is the implementation of #slot: slots "I remove the slots comming from a traitComposition" ^ super slots reject:[ :e | self traitComposition slots includes:e ] If you debug you will notice that super slots returns our #slotFromTrait with an index of 2 while self traitComposition slots returns our #slotFromTrait with an index of 1 while which is the same #slotFromTrait but a different index - therefore it does not get removed. Dont know what is the best way to fix this without any side effects. Commenst and help appreciated. Thanks T.