diff options
author | Matt Joiner <anacrolix@gmail.com> | 2022-10-27 09:34:50 +1100 |
---|---|---|
committer | Matt Joiner <anacrolix@gmail.com> | 2022-10-27 09:34:50 +1100 |
commit | 98fe6924ffad34afef3be56377858fe87afbdfa0 (patch) | |
tree | 5fefaee494505ed310b95f0122e7225f725e5695 /external_test.go | |
parent | Merge pull request #4 from chrismwendt/generics (diff) | |
download | stm-98fe6924ffad34afef3be56377858fe87afbdfa0.tar.gz stm-98fe6924ffad34afef3be56377858fe87afbdfa0.tar.xz |
Mostly fix compatibility with immutable v0.4.0
List has to be dropped because type aliases are not allowed for generic types.
There's an outstanding issue that Set can't contain pointer values. https://github.com/benbjohnson/immutable/issues/25
I would abandon this package altogether, but there's no Set type in immutable, and its comparer and hasher types are more boilerplate than I want.
Diffstat (limited to 'external_test.go')
-rw-r--r-- | external_test.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/external_test.go b/external_test.go index abdf544..1291cce 100644 --- a/external_test.go +++ b/external_test.go @@ -99,7 +99,7 @@ func BenchmarkInvertedThunderingHerd(b *testing.B) { for i := 0; i < b.N; i++ { done := stm.NewBuiltinEqVar(false) tokens := stm.NewBuiltinEqVar(0) - pending := stm.NewVar(stmutil.NewSet()) + pending := stm.NewVar(stmutil.NewSet[*stm.Var[bool]]()) for range iter.N(1000) { ready := stm.NewVar(false) stm.Atomically(stm.VoidOperation(func(tx *stm.Tx) { @@ -132,8 +132,7 @@ func BenchmarkInvertedThunderingHerd(b *testing.B) { for stm.Atomically(func(tx *stm.Tx) bool { tx.Assert(tokens.Get(tx) > 0) tokens.Set(tx, tokens.Get(tx)-1) - pending.Get(tx).Range(func(i any) bool { - ready := i.(*stm.Var[bool]) + pending.Get(tx).Range(func(ready *stm.Var[bool]) bool { if !ready.Get(tx) { ready.Set(tx, true) return false |