comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/expression/DSLExpressionResolver.java @ 20170:953c813b8e7a

DSL: allow comparison of different integral types.
author Chris Seaton <chris.seaton@oracle.com>
date Sun, 05 Apr 2015 20:40:52 +0100
parents 65d29fa81397
children 3648df587223
comparison
equal deleted inserted replaced
20169:65d29fa81397 20170:953c813b8e7a
102 102
103 public void visitBinary(Binary binary) { 103 public void visitBinary(Binary binary) {
104 String operator = binary.getOperator(); 104 String operator = binary.getOperator();
105 TypeMirror leftType = binary.getLeft().getResolvedType(); 105 TypeMirror leftType = binary.getLeft().getResolvedType();
106 TypeMirror rightType = binary.getRight().getResolvedType(); 106 TypeMirror rightType = binary.getRight().getResolvedType();
107 if (!ElementUtils.typeEquals(leftType, rightType)) { 107 if (!ElementUtils.typeCompatible(leftType, rightType)) {
108 throw new InvalidExpressionException(String.format("Incompatible operand types %s and %s.", ElementUtils.getSimpleName(leftType), ElementUtils.getSimpleName(rightType))); 108 throw new InvalidExpressionException(String.format("Incompatible operand types %s and %s.", ElementUtils.getSimpleName(leftType), ElementUtils.getSimpleName(rightType)));
109 } 109 }
110 110
111 TypeMirror booleanType = context.getType(boolean.class); 111 TypeMirror booleanType = context.getType(boolean.class);
112 boolean valid; 112 boolean valid;