Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

499-Index-removeKey-needs-to-use-restoreValue #508

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Soil-Core-Tests/SoilIndexedDictionaryTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -622,9 +622,11 @@ SoilIndexedDictionaryTest >> testRemoveKeyWithTwoTransactions [
tx2 commit.
"check that we can still see in the first tr"
self assert: (tx root at: 2) equals: #two.
"but removeKey: does not see it, to be fixed"
self flag: #TODO.
"tx root removeKey: 2"
"but removeKey: does not see it, we can remove it without error"
tx root removeKey: 2 ifAbsent: [ self fail ].
self assert: tx root size equals: 1.
"but commiting it will fail, as we have commited the remove in t2"
self should: [tx commit] raise: SoilObjectHasConcurrentChange
]

{ #category : #tests }
Expand Down
3 changes: 1 addition & 2 deletions src/Soil-Core/SoilIndexedDictionary.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ SoilIndexedDictionary >> removeKey: key ifAbsent: aBlock [
newValues removeKey: key ifAbsent: nil.
transaction markDirty: self.
iterator := self index newIterator.
v := iterator at: key ifAbsent: [^ aBlock value ].
v isRemoved ifTrue: [ ^ aBlock value ].
v := self basicAt: key ifAbsent: [^ aBlock value].
removedValues
at: key
put: v asSoilObjectId.
Expand Down
Loading