-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
NNBDIssues related to NNBD ReleaseIssues related to NNBD Releaselegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.
Description
The following program resolves an extension on T?
to an int?
receiver, which should result in T
being resolved to int
, and hence the return type of foo
being int
:
extension Test<T> on T? {
T get foo => this!;
}
void main() {
int? a;
a.foo.isEven;
}
The analyzer currently emits an incorrect error on this indicating that the return type of foo
is nullable.
leafp-macbookpro:tmp leafp$ /Users/leafp/src/dart-repo/sdk/xcodebuild/ReleaseX64NNBD/dart-sdk/bin/dartanalyzer --enable-experiment=non-nullable ~/tmp/test4.dart
Analyzing /Users/leafp/tmp/test4.dart...
error • The expression is nullable and must be null-checked before it can be used. • test4.dart:26:3 • unchecked_use_of_nullable_value
cc @scheglov
Metadata
Metadata
Assignees
Labels
NNBDIssues related to NNBD ReleaseIssues related to NNBD Releaselegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.