!10 fix: 比较运算符支持返回 boolean 类型值
Merge pull request !10 from zhangxun/bugfix/fix-binary-operator-not-supports-boolean-result
This commit is contained in:
commit
010f649213
@ -67,9 +67,9 @@ public class BinaryExpressionAnalyzer implements ExpressionAnalyzer<BinaryExpres
|
||||
Type wide = Type.widen(left, right);
|
||||
if (wide == null) wide = BuiltinType.INT; // 容错降级为 int
|
||||
|
||||
// 若为比较运算符,统一返回 int 类型作为布尔值表示
|
||||
// 若为比较运算符,统一返回 boolean 类型作为布尔值表示
|
||||
if ("< <= > >= == !=".contains(op)) {
|
||||
return BuiltinType.INT;
|
||||
return BuiltinType.BOOLEAN;
|
||||
}
|
||||
|
||||
return wide;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user