-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Analyzer throws error when try to assign a function result to row variable. #33805
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
The code should fail to compile. The recursive (F-)bound on |
Isn't it a superbounded type here? |
It isn't actually a super-bounded type: Super-bounded types are concerned with the situation where a type argument list is passed to a generic type (a generic class, a parameterized typedef, or In your example we are dealing with a type argument list which is passed in a generic function invocation. So the whole thing ( |
Ok, so dart should be fixed in this case. |
Yes, in all these cases, there is no valid and inferable type argument for |
Sounds good! Note also #33815 which is the other way round: It shows that the analyzer complains about a super-bounded type given as a type argument that should be allowed. However, I forgot one thing: The original example admits the type argument class A<X> {}
X testme<X extends A<X>>() { return null; }
main() {
A a = testme<Null>();
} Now, everybody (that is, dart and dartanalyzer) are happy, as they should be! But even though it works, I think the situations where it's useful are too rare to justify any attempt to teach the inference engine to try to solve F-bounded constraints with |
Dart SDK Version: 2.0.0-dev.55.0
OS: Windows 10
The following code sample assign a parametrized function result to the row variable:
Dart and dartanalyzer show different results here: test passes without errors or warnings whereas dartanalyzer throws compiler error:
I believe both tools should behave in a similar way.
Seems like
A a = testme();
is OK and should pass in both cases.The text was updated successfully, but these errors were encountered: