Skip to content

Commit 48fa94c

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Report MISSING_DEFAULT_VALUE_FOR_PARAMETER only when NNBD is enabled.
It works now, because we consider types in opt-out libraries as S*, and so far TypsSystem.isPotentiallyNonNullable(S*) returns false, because TypeSystem.isNullable(S*) returns true. But I think this is wrong. The spec says: We say that a type T is nullable if Null <: T. This is equivalent to the syntactic criterion that T is any of: <cut> - S* for some S where S is nullable <cut> So, we currently say that `int*` is nullable. But this is wrong - `int` is not nullable. R=brianwilkerson@google.com, paulberry@google.com Change-Id: I87340fbed23cebd3d68c92579b7d1785b2fc097a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106952 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
1 parent bd1ffcb commit 48fa94c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pkg/analyzer/lib/src/generated/error_verifier.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6059,6 +6059,8 @@ class ErrorVerifier extends RecursiveAstVisitor<void> {
60596059
}
60606060

60616061
void _checkUseOfDefaultValuesInParameters(FormalParameterList node) {
6062+
if (!_isNonNullable) return;
6063+
60626064
AstNode parent = node.parent;
60636065
if (parent is FieldFormalParameter ||
60646066
parent is FunctionTypeAlias ||

0 commit comments

Comments
 (0)