From cca78ad94d7eea4e976b142fbb8955dce014f65c Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Thu, 7 Nov 2019 13:19:38 +0100 Subject: [PATCH 1/2] This is fixing a bug while loading code. In Pharo 7, the loading of code is using a cache for MCDefinitions. When you create a new definition, it checks if one equivalent was already created, if yes, it return this one. The equality of MCClassTraitDefinition does not take the category into account and I got bug while loading code because the MCClassTraitDefinition was wrong because it found one with another category. --- src/Monticello/MCClassTraitDefinition.class.st | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Monticello/MCClassTraitDefinition.class.st b/src/Monticello/MCClassTraitDefinition.class.st index 33bee1460f4..0de2441f16f 100644 --- a/src/Monticello/MCClassTraitDefinition.class.st +++ b/src/Monticello/MCClassTraitDefinition.class.st @@ -28,11 +28,10 @@ MCClassTraitDefinition class >> baseTraitName: aString classTraitComposition: cl { #category : #comparing } MCClassTraitDefinition >> = aDefinition [ - ^ (super = aDefinition) - and: [baseTrait = aDefinition baseTrait - and: [self classTraitCompositionString = aDefinition classTraitCompositionString]] - - + ^ super = aDefinition + and: [ baseTrait = aDefinition baseTrait + and: [ self classTraitCompositionString = aDefinition classTraitCompositionString + and: [ category = aDefinition category ] ] ] ] { #category : #visiting } @@ -91,8 +90,8 @@ MCClassTraitDefinition >> hash [ | hash | hash := String stringHash: baseTrait initialHash: 0. hash := String stringHash: self classTraitCompositionString initialHash: hash. - ^hash - + hash := String stringHash: category initialHash: hash. + ^ hash ] { #category : #initialization } From 8447cbce0bb33e483abfdacac657f3eb9790b7e5 Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Fri, 8 Nov 2019 13:09:29 +0100 Subject: [PATCH 2/2] Add guard --- src/Monticello/MCClassTraitDefinition.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Monticello/MCClassTraitDefinition.class.st b/src/Monticello/MCClassTraitDefinition.class.st index 0de2441f16f..2de9ff28968 100644 --- a/src/Monticello/MCClassTraitDefinition.class.st +++ b/src/Monticello/MCClassTraitDefinition.class.st @@ -90,7 +90,7 @@ MCClassTraitDefinition >> hash [ | hash | hash := String stringHash: baseTrait initialHash: 0. hash := String stringHash: self classTraitCompositionString initialHash: hash. - hash := String stringHash: category initialHash: hash. + category ifNotNil: [ :cat | hash := String stringHash: cat initialHash: hash ]. ^ hash ]