Fixed #1888 Casts in binary operations, not casting any type

This commit is contained in:
Jindra Petřík
2022-11-30 22:58:35 +01:00
parent 954200484c
commit 9e8d00edba
40 changed files with 124 additions and 96 deletions
@@ -31,6 +31,8 @@ import java.util.List;
public class DottedChain implements Serializable, Comparable<DottedChain> {
public static final DottedChain EMPTY = new DottedChain(true);
public static final DottedChain UNBOUNDED = new DottedChain(new String[]{"*"});
public static final DottedChain TOPLEVEL = new DottedChain(new String[]{});
@@ -332,13 +332,13 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
public GraphTextWriter appendTry(GraphTextWriter writer, LocalData localData, String implicitCoerce) throws InterruptedException {
GraphTargetItem t = this;
if (!implicitCoerce.isEmpty()) { //if implicit coerce equals explicit
/*if (!implicitCoerce.isEmpty()) { //if implicit coerce equals explicit
if (t instanceof ConvertAVM2Item) {
if (implicitCoerce.equals((((ConvertAVM2Item) t).type.toString()))) {
t = t.value;
}
}
}
}*/
if (!implicitCoerce.isEmpty() && Configuration.simplifyExpressions.get()) {
t = t.simplify(implicitCoerce);
}
@@ -33,7 +33,7 @@ public class TypeFunctionItem extends GraphTargetItem {
public static TypeFunctionItem ARRAY = new TypeFunctionItem("Array");
public static UnboundedTypeItem UNBOUNDED = new UnboundedTypeItem();
public static UnboundedTypeItem UNBOUNDED = TypeItem.UNBOUNDED;
public String fullTypeName;
@@ -47,8 +47,12 @@ public class TypeItem extends GraphTargetItem {
public static TypeItem ARRAY = new TypeItem(DottedChain.ARRAY);
public static UnboundedTypeItem UNBOUNDED = new UnboundedTypeItem();
public static TypeItem UNKNOWN = new TypeItem("--UNKNOWN--");
public final DottedChain fullTypeName;
public boolean printRaw = false;
public TypeItem(String s) {
this(s == null ? new DottedChain(new String[]{}, new String[]{""}) : DottedChain.parseWithSuffix(s));
@@ -102,7 +102,7 @@ public class TernarOpItem extends GraphTargetItem {
&& (onFalse.returnType().equals(TypeItem.NUMBER) || onFalse.returnType().equals(TypeItem.INT) || onFalse.returnType().equals(TypeItem.UINT))) {
return TypeItem.NUMBER;
}
return TypeItem.UNBOUNDED;
return TypeItem.UNKNOWN;
}
@Override
@@ -50,4 +50,4 @@ public class UnboundedTypeItem extends AVM2Item {
public boolean hasReturnValue() {
return true;
}
}
}