pharo icon indicating copy to clipboard operation
pharo copied to clipboard

For traits variables on the class side do not to load correctly when the trait uses other traits

Open chisandrei opened this issue 3 years ago • 3 comments

When creating a trait with class instance variables that uses other traits, if that trait is committed to a repository and loaded in an image, the class instance variables are lost.

To reproduce, run first the following code, step by step, to create a class, a trait and two traits used by the first trait.

Trait named: #Trait1_1
	instanceVariableNames: ''
	package: 'Haba'.
	
Trait named: #Trait1_2
	instanceVariableNames: ''
	package: 'Haba'.
	
Trait named: #Trait9
	uses: Trait1_1 + Trait1_2
	instanceVariableNames: ''
	package: 'Haba'. 
Trait9 classTrait
	uses: Trait1_1 classTrait + Trait1_2 classTrait
	instanceVariableNames: 'var1'.
	
Object subclass: #Haba9
	uses: Trait9
	instanceVariableNames: ''
	classVariableNames: ''
	package: 'Haba'.

Create a repository, add the package to it and commit it. Then unload and reload the package. When reloading the class instance variable is not added to the trait.

Screenshot 2022-09-14 at 20 40 26

Iceberg also reports a change:

Screenshot 2022-09-14 at 20 40 40

Could reproduce this in

Pharo 10.0 - 64bit (stable)traitstest.image Pharo10.0.0 Build information: Pharo-10.0.0+build.529.sha.84ce6785e2a0778583f749bfe471c0eed8f13b7b (64 Bit) Unnamed

chisandrei avatar Sep 14 '22 18:09 chisandrei

Hi andrei

could you check your scenario in P11 because I know that they fixed a bug recently on traits.

Ducasse avatar Sep 14 '22 18:09 Ducasse

I tried it now in Pharo 11 and I get the same behaviour.

Screenshot 2022-09-14 at 21 00 45

Pharo 11.0 - 64bit (development version, latest) traits.image Pharo11.0.0 Build information: Pharo-11.0.0+build.198.sha.05cd6583896f68c39494581ab454ff7f03f40b71 (64 Bit) Unnamed

chisandrei avatar Sep 14 '22 19:09 chisandrei

tx!

Ducasse avatar Sep 14 '22 19:09 Ducasse