-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
NNBD, i-2-b: Analyzer throws unexpected error for contravariant function type parameter #42196
Comments
Looks like the analyzer with // Type variable mapping
X --> G<A<Object?, Object?>>
Y --> Never.
// Bounds check
X <: G<A<X, Y>> -->
G<A<Object?, Object?>> <: G<A<G<A<Object?, Object?>>, Never>>, true if
Function(A<Object?, Object?>) <: Function(A<G<A<Object?, Object?>>, Never>), true if
A<G<A<Object?, Object?>>, Never> <: A<Object?, Object?>, which is true. |
I don't understand this area well enough to solve this issue. |
I was just checking that |
@MichaelRFairhurst - is this fixed as of https://dart-review.googlesource.com/c/sdk/+/156443 ? |
Bug: #42196 Change-Id: If9350ccc4ad2908a2c7cde7281fe9e2f01c52f97 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156561 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This was fixed. |
@eernstg I don't understand your comment above, I don't think we've updated the spec here for null safety have we? That is, I think there's missing spec work here. |
That's true, dart-lang/language#1133 updates the null-safety spec accordingly. |
Dart VM version: 2.9.0-13.0.dev (dev) (Fri May 29 15:59:05 2020 +0200) on "windows_x64"
The following source code example prints "OK" with dart and throws a compile error with analyzer:
Sample output is:
Please note that this problem is not reproducible in legacy code, i.e. the following example passes both with analyzer and dart when runs without --enable-experiment=non-nullable flag:
The text was updated successfully, but these errors were encountered: