Skip to content

Commit

Permalink
[analyzer] Make sure the error check avoidance on InvalidTypes use ha…
Browse files Browse the repository at this point in the history
…sInvalidType()

Avoid throwing `CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH` for any type of `InvalidType`s since we don't want to do any type checking if we don't actually know the types.

This is another fix for breakages in g3.

b/294003447

Change-Id: Id38de02cfd0317dc6771944bec0f54efb2614494
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317500
Commit-Queue: Kallen Tu <[email protected]>
Reviewed-by: Samuel Rawlins <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
  • Loading branch information
kallentu authored and Commit Queue committed Aug 2, 2023
1 parent 9bf4af0 commit 291f6d8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pkg/analyzer/lib/src/dart/constant/value.dart
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class DartObjectImpl implements DartObject, Constant {

/// Return `true` if this object represents an object whose type is an invalid
/// type.
bool get isInvalid => state.isInvalid;
bool get isInvalid => state.isInvalid || hasInvalidType(type);

@override
bool get isNull => state is NullState;
Expand Down Expand Up @@ -308,10 +308,7 @@ class DartObjectImpl implements DartObject, Constant {
}

// If any type is unresolved, we cannot prove that the cast will fail.
if (isInvalid ||
castType.isInvalid ||
hasInvalidType(type) ||
hasInvalidType(resultType)) {
if (isInvalid || castType.isInvalid) {
return this;
}

Expand Down

0 comments on commit 291f6d8

Please sign in to comment.