diff --git a/compiler/compiler.go b/compiler/compiler.go index 2b3419ed48..0f3db97b6d 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -420,19 +420,19 @@ func (c *compilerContext) makeLLVMType(goType types.Type) llvm.Type { return c.ctx.Int8Type() case types.Int16, types.Uint16: return c.ctx.Int16Type() - case types.Int32, types.Uint32: + case types.Int32, types.Uint32, types.UntypedRune: return c.ctx.Int32Type() - case types.Int, types.Uint: + case types.Int, types.Uint, types.UntypedInt: return c.intType case types.Int64, types.Uint64: return c.ctx.Int64Type() case types.Float32: return c.ctx.FloatType() - case types.Float64: + case types.Float64, types.UntypedFloat: return c.ctx.DoubleType() case types.Complex64: return c.ctx.StructType([]llvm.Type{c.ctx.FloatType(), c.ctx.FloatType()}, false) - case types.Complex128: + case types.Complex128, types.UntypedComplex: return c.ctx.StructType([]llvm.Type{c.ctx.DoubleType(), c.ctx.DoubleType()}, false) case types.String, types.UntypedString: return c.getLLVMRuntimeType("_string") diff --git a/compiler/testdata/basic.go b/compiler/testdata/basic.go index 6c6f983e37..16d8c6ce8c 100644 --- a/compiler/testdata/basic.go +++ b/compiler/testdata/basic.go @@ -66,6 +66,11 @@ func complexSub(x, y complex64) complex64 { return x - y } +func shiftNested(x uint64) uint64 { + k := 3 + return x >> (1 << k) // https://github.com/tinygo-org/tinygo/issues/5496 +} + func complexMul(x, y complex64) complex64 { return x * y }