pharo icon indicating copy to clipboard operation
pharo copied to clipboard

Removing a trait on the instance side of a class declaration with Fluid class do not remove it on the class side

Open jecisc opened this issue 2 years ago • 1 comments

Bug description Today I removed a trait while using the Fluid class definition in a class but my CI crashed because the trait was still used on the class side of the class.

Expected behavior Until now, if we added/removed a trait on the instance side of a class, it applied this change on the class side. I expected this behaviour to be kept. also

Version information:

  • OS: Windows
  • Version: 11
  • Pharo Version 10

jecisc avatar May 25 '22 14:05 jecisc

FluidBuilder >> fillShiftClassBuilder is in cause. Should be

fillShiftClassBuilder 

	shiftClassBuilder := ShiftClassBuilder new.
	shiftClassBuilder	
		buildEnvironment: ShSmalltalkGlobalsEnvironment new;
		name: nameToBuild.
	
	shiftClassBuilder slots: slotsToBuild.	
	shiftClassBuilder traitComposition: uses asTraitComposition.
	
	(tagToBuild isNil or: [ tagToBuild isEmpty ])
		ifTrue: [ shiftClassBuilder category: packageName ]
		ifFalse: [ tagToBuild isEmpty 
						ifFalse: [ shiftClassBuilder category: packageName, '-', tagToBuild asString ]
						ifTrue: [ shiftClassBuilder category: packageName ]
		].
	
	shiftClassBuilder classSlots: classSlotsToBuild.
	shiftClassBuilder classTraitComposition: uses asTraitComposition classComposition.

or

fillShiftClassBuilder 

	shiftClassBuilder := ShiftClassBuilder new.
	shiftClassBuilder	
		buildEnvironment: ShSmalltalkGlobalsEnvironment new;
		name: nameToBuild.
	
	shiftClassBuilder slots: slotsToBuild.	
	shiftClassBuilder traitComposition: uses asTraitComposition.
	
	(tagToBuild isNil or: [ tagToBuild isEmpty ])
		ifTrue: [ shiftClassBuilder category: packageName ]
		ifFalse: [ tagToBuild isEmpty 
						ifFalse: [ shiftClassBuilder category: packageName, '-', tagToBuild asString ]
						ifTrue: [ shiftClassBuilder category: packageName ]
		].
	
	shiftClassBuilder classSlots: classSlotsToBuild.

But it broke test cuause classTraits: is supposed to be API so now I don't know if it is voluntary to change the behavior to the current one.

Alisu avatar Jun 24 '22 13:06 Alisu