-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onlegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
If we have code like
UnknownType? getValue() {
return null;
}
if (getValue() case final valueX?) {
return Text(valueX);
}When my UnknownType type is InvalidType because like in cases when maybe imports are wrong, or generated code is not generated, fix (we have auto fix on save) removes the ? while it is NOT CORRECT and will lead to errors when non null expected below.
The fix is there because of this code https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/lib/src/services/correction/dart/remove_question_mark.dart#L45 which is probably missing some check for InvalidType in which case it should not suggest the fix.
Edit: The same thing for null assert.
FMorschel and ivicicm
Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onlegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)