Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loosen a type test for constants corresponding to their expressions.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 575618753
lukesandberg authored and copybara-github committed Oct 23, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 8ebc3ae commit a0a9c63
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -418,8 +418,8 @@ protected Expression(
this.constantValue = checkNotNull(constantValue);
if (Flags.DEBUG && constantValue.isPresent()) {
checkState(
resultType.equals(constantValue.get().type),
"Type mismatch. Expected constant value of type %s to have type %s",
BytecodeUtils.isPossiblyAssignableFrom(resultType, constantValue.get().type),
"Type mismatch. Expected constant value of type %s to to be assignable to %s",
constantValue.get().type,
resultType);
}
@@ -583,7 +583,10 @@ public Expression asSoyNullish() {
if (!isNonSoyNullish()) {
return this;
}
checkAssignableTo(BytecodeUtils.SOY_VALUE_TYPE);
return new DelegatingExpression(
// The only type that is a super type of a NullData,UndefinedData and any other SoyValue is
// SoyValue itself.
this, BytecodeUtils.SOY_VALUE_TYPE, features.minus(Feature.NON_SOY_NULLISH));
}

0 comments on commit a0a9c63

Please sign in to comment.