-
Notifications
You must be signed in to change notification settings - Fork 205
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
Analyzer and CFE disagree on inferred Future.value type with nullable argument #3304
Comments
CC @dart-lang/language-team |
Both are - The getter isn't defined for either of those types 😉
Edit: I forgot about the nullable argument to |
I don't think this is tightly related, because downward inference gives no info in this case. However, as @eernstg says over there:
This might be the same choice? I think it's essentially:
Luckily for me, I'm not looking for a language change. I'm just looking to figure out which implementation is not spec-compliant :D. |
The "Who is right" should be answered by the inference specification. In particular which, if I read it correctly, means that the only introduced constraint is So, analyzer is correct, as I read it. |
I agree with @lrhn - the analyzer is correct here. |
@natebosch wrote:
#3269 refers to the same inference rule, here, and it would be applicable during downward inference as well as upward inference. It seems fair to say that the two issues are at least closely related. |
Resolved. |
Take this code:
Future<int>
'."Future<int?>
'."Who is correct? It would be less breaking to change analyzer's behavior 😁
This is a blocker for implementing dart-lang/sdk#53253. As things stand, the analyzer would report a new Warning, claiming that a nullable value,
x
should not be passed toFuture<int>.value
, but there is actually no error thrown at runtime, so it should always be OK to pass this nullable value.The text was updated successfully, but these errors were encountered: