aboutsummaryrefslogtreecommitdiffhomepage
path: root/compiler/asserts.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2019-09-26 15:36:23 +0200
committerRon Evans <[email protected]>2019-10-01 21:31:00 +0200
commit01e58691a16a9bea24b6ea5e57b81c95133af86a (patch)
treeba11c829d4592262914b23d4f60a63b6f8f45956 /compiler/asserts.go
parent81c0f9af4e30485726f15b2342244b39a042ac96 (diff)
downloadtinygo-01e58691a16a9bea24b6ea5e57b81c95133af86a.tar.gz
tinygo-01e58691a16a9bea24b6ea5e57b81c95133af86a.zip
compiler: support constant indices with a named type
Diffstat (limited to 'compiler/asserts.go')
-rw-r--r--compiler/asserts.go2
1 files changed, 1 insertions, 1 deletions
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(), "")