Skip to content

Commit

Permalink
fix a type error
Browse files Browse the repository at this point in the history
  • Loading branch information
irmen committed Oct 10, 2024
1 parent 1a6b95b commit 7651ccc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/src/prog8/compiler/astprocessing/VariousCleanups.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 7651ccc

Please sign in to comment.