From 01e58691a16a9bea24b6ea5e57b81c95133af86a Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Thu, 26 Sep 2019 15:36:23 +0200 Subject: compiler: support constant indices with a named type --- compiler/asserts.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/asserts.go') diff --git a/compiler/asserts.go b/compiler/asserts.go index b9f02e849..ad79c0a13 100644 --- a/compiler/asserts.go +++ b/compiler/asserts.go @@ -22,7 +22,7 @@ func (c *Compiler) emitLookupBoundsCheck(frame *Frame, arrayLen, index llvm.Valu if index.Type().IntTypeWidth() < arrayLen.Type().IntTypeWidth() { // Sometimes, the index can be e.g. an uint8 or int8, and we have to // correctly extend that type. - if indexType.(*types.Basic).Info()&types.IsUnsigned == 0 { + if indexType.Underlying().(*types.Basic).Info()&types.IsUnsigned == 0 { index = c.builder.CreateZExt(index, arrayLen.Type(), "") } else { index = c.builder.CreateSExt(index, arrayLen.Type(), "") -- cgit v1.2.3