Skip to content

Commit

Permalink
[analyzer] Fix broken code generators in g3.
Browse files Browse the repository at this point in the history
Some part of the code generators trigger the `??` RHS operand when there is an unresolved type on the LHS.

In the previous const evaluator prior to https://dart-review.googlesource.com/c/sdk/+/312347, errors triggered by unresolved types would be ignored. Now that we have specific unresolved constants, we need to short circuit the evaluation in some places.

Anyways, this change makes unresolved types return LHS early (they're represented by a `Null` state) until I can find a better fix for this.

b/293326927

Change-Id: Ifcbff9921e1d4a82dc24153b042eaaa862bcca68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316490
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
  • Loading branch information
kallentu authored and Commit Queue committed Jul 27, 2023
1 parent 293d32f commit 13a986d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/analyzer/lib/src/dart/constant/evaluation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2023,6 +2023,11 @@ class DartObjectComputer {
Constant lazyQuestionQuestion(Expression node, DartObjectImpl leftOperand,
Constant Function() rightOperandComputer) {
if (leftOperand.isNull) {
// TODO(kallentu): Remove this once we have a better representation for
// unresolved types.
if (leftOperand.isInvalid) {
return leftOperand;
}
return rightOperandComputer();
}
return leftOperand;
Expand Down

0 comments on commit 13a986d

Please sign in to comment.