aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2020-11-24 00:58:00 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2020-11-24 03:06:15 +0000
commit7dc5d909fb465345bf1583eb978aaa56ca365f38 (patch)
tree9278347c34dbc18ebb208e76121ef1c9367a0522 /test
parent762eda346a9f4062feaa8a9fc0d17d72b11586f0 (diff)
downloadgo-7dc5d909fb465345bf1583eb978aaa56ca365f38.tar.gz
go-7dc5d909fb465345bf1583eb978aaa56ca365f38.zip
cmd/compile: set OpLoad argument type interface{} correctly
CL 271906 allows loading single field of typed-interface{} OpIData, but it does not update the corresponding selector type. So the generated OpLoad has the named type instead, prevent it from being lowered by lower pass. Fixes #42784 Change-Id: Idf32e4f711731be09d508dd712b60bc8c58309bd Reviewed-on: https://go-review.googlesource.com/c/go/+/272466 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/fixedbugs/issue42784.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/fixedbugs/issue42784.go b/test/fixedbugs/issue42784.go
new file mode 100644
index 0000000000..e2b06e9307
--- /dev/null
+++ b/test/fixedbugs/issue42784.go
@@ -0,0 +1,26 @@
+// compile
+
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Ensure that late expansion correctly set OpLoad argument type interface{}
+
+package p
+
+type iface interface {
+ m()
+}
+
+type it interface{}
+
+type makeIface func() iface
+
+func f() {
+ var im makeIface
+ e := im().(it)
+ g(e)
+}
+
+//go:noinline
+func g(i it) {}