-
Notifications
You must be signed in to change notification settings - Fork 1.7k
StrongTypeSystemImpl.isAssignableTo returns wrong result in one case #35300
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
Comments
Assuming I'm creating a correct a code example to this...
This looks like it should be valid at first...but its not! Proof by contradiction:
In this case, |
@lrhn I originally opened this issue because I thought this was a bug in analyzer that was preventing some of the set literal tests from passing (set_literal_test.dart and const_set_literal_test.dart). If Mike is right, then I think that some portions of those two tests are invalid. |
@MichaelRFairhurst is right, knowing only You could have other subtypes with a bound: So maybe this issue should be retargeted to correct
|
I agree that there is a problem with the tests. Similar tests worked for double literals, so I copied them, but those tests didn't get into generics. It's true that We could change the rules to, say, make the empty-set/map-literal a set if there exists some type I'll fix the tests: https://dart-review.googlesource.com/c/sdk/+/85740 |
See #35300 Bug: http://dartbug.com/35300 Change-Id: I00610ce9eadc51499fc5f35d43095dbf29d07543 Reviewed-on: https://dart-review.googlesource.com/c/85740 Reviewed-by: Erik Ernst <[email protected]> Commit-Queue: Lasse R.H. Nielsen <[email protected]>
I'm fixing the test now, but keeping the door open for changing the specification if the current one is too restrictive. |
Given that the analyzer's implementation was right and the tests were wrong, I'm closing this. |
The type system implementation of
isAssignableTo
is broken in the case where the first argument isSet<Null>
and the second argument is a type parameterT
whose bound is something likeSet<int>
. (The classSet
can be replaced by anything, and the typeint
can be replaced by anything other thanNull
.)This is blocking #35120.
The text was updated successfully, but these errors were encountered: