Hi Yanni
The attached test case, reproduced below:
| result |
self analyzer
� � � �when: [:x | FLPair = x class and: [x left isNil not] ]
� � � �substituteBy: [:x | x copy left: $A ].
result := self resultOfSerializeAndMaterialize:
� � � �(FLPair new left: $a; right: $b; yourself). � �
self assert: result left = $A.
causes an infinite loop with IdentityDictionary (see stack trace at end).
The similar test case #testTransientPairLeft, works because the guard condition is negated by the replacement (i.e. "x left isNil not" is made false by the replacement).
The attached test case does not make "x left isNil not" false. It causes an infinite recursion, so use "ctrl-." to stop it before too long.
Is this a bug, or the intention of the #when:substituteBy: feature? I've worked around it, by making sure to always have the substituted value fail the guard clause.
--
Yanni
==== stack trace ====
IdentityDictionary>>scanFor:
IdentityDictionary(HashedCollection)>>findElementOrNil:
IdentityDictionary(Dictionary)>>at:ifAbsent:
FLPluggableSubstitutionCluster(FLSubstitutionCluster)>>add:traceWith:
FLAnalysis>>mapAndTrace:
FLAnalysis>>run
[:anObject | (FLAnalysis newWith: self firstInMapperChain root: anObject) run; yourself] in FLAnalyzer>>setDefaultAnalysis
FLAnalyzer>>analysisFor:
FLSerialization>>analysisStep
FLSerialization>>run
[:anObject :aStream | (FLSerialization
� � � � � � � �root: anObject
� � � � � � � �on: aStream
� � � � � � � �analyzer: self analyzer) run; yourself] in FLSerializer>>defaultSerialization
[self nextPutSignatureOn: aStream.
� � � �self nextPutVersionOn: aStream.
� � � �^ self serializationFactory value: anObject value: aStream] in FLSerializer>>serialize:on:
BlockClosure>>ensure:
FLSerializer>>serialize:on:
[:aStream | self serializer serialize: anObject on: aStream] in FLPluggableSubstitutionTest(FLSerializationTest)>>serialize:
[:aStream | aValuable value: aStream binary] in FLFileStreamStrategy>>writeStreamDo:
[anotherBlock value: file] in MultiByteFileStream class(FileStream class)>>detectFile:do:
BlockClosure>>ensure:
MultiByteFileStream class(FileStream class)>>detectFile:do:
MultiByteFileStream class(FileStream class)>>forceNewFileNamed:do: