Skip to content

Commit

Permalink
A bug in the compile-time value of ternary expression is fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehsan Khamespanah committed Apr 25, 2024
1 parent 3789e2d commit 966aa2e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.rebecalang</groupId>
<artifactId>compiler</artifactId>
<version>2.19</version>
<version>2.20</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<springframework.version>6.1.2</springframework.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public Pair<Type, Object> check(Expression expression, Type baseType) {
returnValue.setFirst(variableInScopeSpecifier.getType());
termPrimary.setType(variableInScopeSpecifier.getType());
Object value = variableInScopeSpecifier.getPrecompilationValue();
returnValue.setSecond(value);
if(value != null)
returnValue.setSecond(value);
} else {
Type curType = baseType;
Type symbolType = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public Pair<Type, Object> check(Expression expression, Type baseType) {
}

returnValue.setFirst(tExpression.getType());
if (cType.getSecond() != null) {
if (cType.getSecond() != AbstractExpressionSemanticCheck.NO_VALUE) {
if (lType.getSecond() != null && rType.getSecond() != null)
if (((Boolean) cType.getSecond()).booleanValue()) {
returnValue.setSecond(lType.getSecond());
Expand Down

0 comments on commit 966aa2e

Please sign in to comment.