diff --git a/compiler/src/prog8/compiler/astprocessing/VariousCleanups.kt b/compiler/src/prog8/compiler/astprocessing/VariousCleanups.kt index d0ee75e88..6f66c32c9 100644 --- a/compiler/src/prog8/compiler/astprocessing/VariousCleanups.kt +++ b/compiler/src/prog8/compiler/astprocessing/VariousCleanups.kt @@ -135,7 +135,9 @@ internal class VariousCleanups(val program: Program, val errors: IErrorReporter, } if(isMultiComparisonRecurse(leftBinExpr1)) { - val elementType = needle.inferType(program).getOrElse { throw FatalAstException("invalid needle dt") } + val elementIType = needle.inferType(program) + if(elementIType.isUnknown) return noModifications + val elementType = elementIType.getOrElse { DataType.UNDEFINED } if(values.size==2 || values.size==3 && (elementType==DataType.UBYTE || elementType==DataType.UWORD)) { val numbers = values.map{it.number}.toSet() if(numbers == setOf(0.0, 1.0)) {