From 2c7424fd43f537ada321b76640154571ef2d6e9b Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Mon, 23 Mar 2020 22:35:23 +0100 Subject: [PATCH] fix: datatype mismatch in optimized bitshift const value --- compiler/src/prog8/optimizer/ExpressionSimplifier.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/src/prog8/optimizer/ExpressionSimplifier.kt b/compiler/src/prog8/optimizer/ExpressionSimplifier.kt index a764b2f33..a40d14475 100644 --- a/compiler/src/prog8/optimizer/ExpressionSimplifier.kt +++ b/compiler/src/prog8/optimizer/ExpressionSimplifier.kt @@ -510,12 +510,12 @@ internal class ExpressionSimplifier(private val program: Program) : AstWalker() when (targetDt) { DataType.UBYTE, DataType.BYTE -> { if (amount >= 8) { - return NumericLiteralValue.optimalInteger(0, expr.position) + return NumericLiteralValue(targetDt, 0, expr.position) } } DataType.UWORD, DataType.WORD -> { if (amount >= 16) { - return NumericLiteralValue.optimalInteger(0, expr.position) + return NumericLiteralValue(targetDt, 0, expr.position) } else if (amount >= 8) { val lsb = TypecastExpression(expr.left, DataType.UBYTE, true, expr.position) if (amount == 8) {