Skip to content

Commit c0023ce

Browse files
committed
Fix checks for experimental type checking
1 parent ed4301f commit c0023ce

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/main/java/nextflow/script/control/TypeCheckingVisitorEx.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,9 @@ public void visitShortTernaryExpression(ElvisOperatorExpression node) {
962962
}
963963

964964
private void applyConditionalExpression(TernaryExpression node) {
965+
if( !experimental )
966+
return;
967+
965968
var trueExpr = node.getTrueExpression();
966969
var falseExpr = node.getFalseExpression();
967970
var trueType = getType(trueExpr);
@@ -986,8 +989,7 @@ else if( TypesEx.isEqual(trueType, falseType) ) {
986989
nullable = isNullable(trueType) || isNullable(falseType);
987990
}
988991
else {
989-
if( experimental )
990-
addError(String.format("Conditional expression has inconsistent types -- true branch has type %s but false branch has type %s", TypesEx.getName(trueType), TypesEx.getName(falseType)), node);
992+
addError(String.format("Conditional expression has inconsistent types -- true branch has type %s but false branch has type %s", TypesEx.getName(trueType), TypesEx.getName(falseType)), node);
991993
return;
992994
}
993995

@@ -1055,6 +1057,9 @@ public void visitMapExpression(MapExpression node) {
10551057
public void visitRangeExpression(RangeExpression node) {
10561058
super.visitRangeExpression(node);
10571059

1060+
if( !experimental )
1061+
return;
1062+
10581063
var lhs = node.getFrom();
10591064
var rhs = node.getTo();
10601065
var lhsType = getType(lhs);

0 commit comments

Comments
 (0)