Skip to content
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: Implementation of super-bounded types with null safety #43524

Closed
eernstg opened this issue Sep 22, 2020 · 1 comment
Closed

Analyzer: Implementation of super-bounded types with null safety #43524

eernstg opened this issue Sep 22, 2020 · 1 comment
Assignees
Labels
analyzer-spec Issues with the analyzer's implementation of the language spec area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.

Comments

@eernstg
Copy link
Member

eernstg commented Sep 22, 2020

With null safety, the spec update in dart-lang/language#1133 calls for the use of Never rather than Null during instantiation to bound, and during the checks for being a correctly super-bounded type.

Some work was done on this in 744e34a, but the following example illustrates that the analyzer still uses Null:

class A<X extends void Function(X)> {}

void main() {
  A a = A<Never>();
}

The response (with the analyzer from commit ecc87a1) is as follows:

ERROR|COMPILE_TIME_ERROR|TYPE_ARGUMENT_NOT_MATCHING_BOUNDS|/usr/local/google/home/eernst/lang/dart/scratch/202009/n025.dart|4|3|1|'void Function(Null)' doesn't extend 'void Function(void Function(Null))'.

This shows that the raw A is expanded by i2b to A<void Function(Null)>, and then the bounds check fails.

When A is expanded to A<void Function(Never)> the type is correctly super-bounded and the raw A is allowed, and this is the expected outcome after #1133.

@eernstg eernstg added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Sep 22, 2020
@scheglov scheglov self-assigned this Sep 28, 2020
@scheglov scheglov added the analyzer-spec Issues with the analyzer's implementation of the language spec label Sep 28, 2020
@scheglov
Copy link
Contributor

dart-bot pushed a commit that referenced this issue Sep 28, 2020
Bug: #34699
Bug: #43524
Change-Id: I8fe14c59fff17f3e4ebee62fbd7be2b45172a595
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-spec Issues with the analyzer's implementation of the language spec area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
Projects
None yet
Development

No branches or pull requests

2 participants