From 7ceb76cff57762cb1c496fbac9204139407803ea Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Thu, 18 May 2023 22:46:00 +0200 Subject: [PATCH] fix compiler crash on certain operands type mismatch --- compiler/src/prog8/compiler/astprocessing/AstChecker.kt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt index 9342d4cc8..9d01593a9 100644 --- a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt +++ b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt @@ -958,11 +958,7 @@ internal class AstChecker(private val program: Program, } } - if(expr.operator in ComparisonOperators) { - if(leftDt!=rightDt && !(leftDt in ByteDatatypes && rightDt in ByteDatatypes)) { - throw FatalAstException("got comparison with different operand types: $leftDt ${expr.operator} $rightDt ${expr.position}") - } - } else { + if(expr.operator !in ComparisonOperators) { if (leftDt == DataType.STR && rightDt == DataType.STR || leftDt in ArrayDatatypes && rightDt in ArrayDatatypes) { // str+str and str*number have already been const evaluated before we get here. errors.err("no computational or logical expressions with strings or arrays are possible", expr.position)