Fix bug in dev-compiler putIfAbsent.

Was adding key to _keymap before calling `ifAbsent`,
so `containsKey` saw it during the `ifAbsent` call.

Modified to allow concurrent modification inthe `ifAbsent` function,
like other platforms already do. Documentation updated to match.

Fixes #47852

CoreLibraryReviewExempt: DDC only change, other than docs.
Bug: https://dartbug.com/47852
Change-Id: Ia289f426b1c9ad37ce89eda5119f9086dc5d39b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/222200
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
This commit is contained in:
Lasse R.H. Nielsen
2024-12-09 11:40:42 +00:00
committed by Commit Queue
parent 71f7a42f42
commit 0bd3dfa398
10 changed files with 622 additions and 90 deletions
+4
View File
@@ -434,6 +434,10 @@ class Expect {
_fail('Expect.mapEquals(unexpected key: <$key>$msg) fails');
}
}
if (expectedKeys.length != actualKeys.length) {
_failNotEqual(expectedKeys.length, actualKeys.length,
"mapEquals", "map.length");
}
}
/// Specialized equality test for strings. When the strings don't match,