diff options
Diffstat (limited to 'src/cmd/compile/internal/gc/typecheck.go')
-rw-r--r-- | src/cmd/compile/internal/gc/typecheck.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/cmd/compile/internal/gc/typecheck.go b/src/cmd/compile/internal/gc/typecheck.go index 1379bb56d4..d5aa0a8fd7 100644 --- a/src/cmd/compile/internal/gc/typecheck.go +++ b/src/cmd/compile/internal/gc/typecheck.go @@ -1114,7 +1114,7 @@ OpSwitch: case OSLICE, OSLICE3: ok |= Erv - n.Left = typecheck(n.Left, top) + n.Left = typecheck(n.Left, Erv) low, high, max := n.SliceBounds() hasmax := n.Op.IsSlice3() low = typecheck(low, Erv) @@ -1126,6 +1126,10 @@ OpSwitch: max = indexlit(max) n.SetSliceBounds(low, high, max) l := n.Left + if l.Type == nil { + n.Type = nil + return n + } if l.Type.IsArray() { if !islvalue(n.Left) { yyerror("invalid operation %v (slice of unaddressable value)", n) @@ -1138,12 +1142,7 @@ OpSwitch: n.Left = typecheck(n.Left, Erv) l = n.Left } - t := l.Type - if t == nil { - n.Type = nil - return n - } var tp *Type if t.IsString() { if hasmax { |