From 7651ccc84e8b9af22b4c10330c41d5bac45a4a2b Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Fri, 11 Oct 2024 00:50:05 +0200 Subject: [PATCH] fix a type error --- compiler/src/prog8/compiler/astprocessing/VariousCleanups.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)) {