summaryrefslogtreecommitdiffstats
path: root/llgo/test/llgoi
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-03-18 08:34:40 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-03-18 08:34:40 +0000
commit38a7dde1c5dfcbb69f90ee961e6b2583f0928257 (patch)
treeb7ee995477c2d77f4400395eb0e56de1568c9fcd /llgo/test/llgoi
parentd8dee1f54bfa6cc71806e2f960cd7a1fe4768a75 (diff)
downloadbcm5719-llvm-38a7dde1c5dfcbb69f90ee961e6b2583f0928257.tar.gz
bcm5719-llvm-38a7dde1c5dfcbb69f90ee961e6b2583f0928257.zip
llgoi: Fix type identity for imported binary packages.
go/loader creates a fresh package map for each source package it imports. In llgoi this caused binary imported packages to be imported anew for every input line, resulting in spurious type errors and panics in go/ssa when encountering previously imported types. Fix this by setting types.Config.Packages to our internal package map. Differential Revision: http://reviews.llvm.org/D8409 llvm-svn: 232617
Diffstat (limited to 'llgo/test/llgoi')
-rw-r--r--llgo/test/llgoi/import-source.test12
1 files changed, 11 insertions, 1 deletions
diff --git a/llgo/test/llgoi/import-source.test b/llgo/test/llgoi/import-source.test
index c5a3eabf38d..b545b52697e 100644
--- a/llgo/test/llgoi/import-source.test
+++ b/llgo/test/llgoi/import-source.test
@@ -1,4 +1,4 @@
-// RUN: env GOPATH=%S/Inputs llgoi < %s | FileCheck %s
+// RUN: env GOPATH=%S/Inputs llgoi < %s 2>&1 | FileCheck %s
// make sure user symbols do not conflict with imported source package
Answer := 1
@@ -16,5 +16,15 @@ foo.Answer()
strconv.FormatBool(true)
// CHECK: #0 string = true
+var v1 strconv.NumError
+var v2 strconv.NumError
+
+// v1 and v2 should have the same type identity.
+// CHECK-NOT: cannot assign
+v1 = v2
+
+// Method lookup relies on v1 having a consistent type.
+v1.Error
+
import "foo_cgo"
// CHECK: foo_cgo: cannot load cgo package
OpenPOWER on IntegriCloud