-
Notifications
You must be signed in to change notification settings - Fork 214
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
Fix a type error that occurs comparing two large maps with deepEquals
.
#2442
base: master
Are you sure you want to change the base?
Fix a type error that occurs comparing two large maps with deepEquals
.
#2442
Conversation
PR HealthChangelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. |
// List<Iterable<String>> which ends up as a type error in dart:collection | ||
// when the underlying list is actually a List<List<String>>. See | ||
// https://github.com/dart-lang/test/issues/2441 for more details. | ||
elements.replaceRange(_maxItems - 1, elements.length, <List<String>>[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option could be to make this a top level variable (const?)? Then we wouldn't have to force inference and it would be shared across invocations.
Interesting real world case of a covariant generics fail.... I haven't seen one of these maybe ever in actual practice haha. |
Fwiw this is the actual culprit line that creates a A different solution would be to convert this to return an iterable, which may have (good or bad) performance characteristics, something like this: return key.take(key.length - 1).followedBy(
['${key.last}: ${value.first}']).followedBy(value.skip(1)); There is a similar issue here https://github.com/dart-lang/test/blob/master/pkgs/checks/lib/src/describe.dart#L88 |
@@ -29,6 +29,65 @@ void main() { | |||
test('values', () { | |||
check(_testMap).values.contains(1); | |||
}); | |||
test('can be described failing compared to another large map', () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the same issue exists for lists so it would be good to also test that (although I think your fix will work for both).
Closes #2441.
I am not 100% sure why this occurs, and why the repro case needs to be of a certain design/size, but here ya go.