aboutsummaryrefslogtreecommitdiff
path: root/internal/gcimporter/testdata
diff options
context:
space:
mode:
Diffstat (limited to 'internal/gcimporter/testdata')
-rw-r--r--internal/gcimporter/testdata/a.go14
-rw-r--r--internal/gcimporter/testdata/a/a.go14
-rw-r--r--internal/gcimporter/testdata/b.go11
-rw-r--r--internal/gcimporter/testdata/exports.go89
-rw-r--r--internal/gcimporter/testdata/issue15920.go11
-rw-r--r--internal/gcimporter/testdata/issue20046.go9
-rw-r--r--internal/gcimporter/testdata/issue25301.go17
-rw-r--r--internal/gcimporter/testdata/issue51836/a.go8
-rw-r--r--internal/gcimporter/testdata/issue51836/a/a.go8
-rw-r--r--internal/gcimporter/testdata/issue51836/aa.go13
-rw-r--r--internal/gcimporter/testdata/issue57015.go16
-rw-r--r--internal/gcimporter/testdata/issue58296/a/a.go9
-rw-r--r--internal/gcimporter/testdata/issue58296/b/b.go11
-rw-r--r--internal/gcimporter/testdata/issue58296/c/c.go11
-rw-r--r--internal/gcimporter/testdata/p.go13
-rw-r--r--internal/gcimporter/testdata/versions/test.go30
-rw-r--r--internal/gcimporter/testdata/versions/test_go1.11_0i.abin0 -> 2420 bytes
-rw-r--r--internal/gcimporter/testdata/versions/test_go1.11_6b.abin0 -> 2426 bytes
-rw-r--r--internal/gcimporter/testdata/versions/test_go1.11_999b.abin0 -> 2600 bytes
-rw-r--r--internal/gcimporter/testdata/versions/test_go1.11_999i.abin0 -> 2420 bytes
-rw-r--r--internal/gcimporter/testdata/versions/test_go1.7_0.abin0 -> 1862 bytes
-rw-r--r--internal/gcimporter/testdata/versions/test_go1.7_1.abin0 -> 2316 bytes
-rw-r--r--internal/gcimporter/testdata/versions/test_go1.8_4.abin0 -> 1658 bytes
-rw-r--r--internal/gcimporter/testdata/versions/test_go1.8_5.abin0 -> 1658 bytes
24 files changed, 284 insertions, 0 deletions
diff --git a/internal/gcimporter/testdata/a.go b/internal/gcimporter/testdata/a.go
new file mode 100644
index 000000000..56e4292cd
--- /dev/null
+++ b/internal/gcimporter/testdata/a.go
@@ -0,0 +1,14 @@
+// Copyright 2016 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.
+
+// Input for TestIssue13566
+
+package a
+
+import "encoding/json"
+
+type A struct {
+ a *A
+ json json.RawMessage
+}
diff --git a/internal/gcimporter/testdata/a/a.go b/internal/gcimporter/testdata/a/a.go
new file mode 100644
index 000000000..56e4292cd
--- /dev/null
+++ b/internal/gcimporter/testdata/a/a.go
@@ -0,0 +1,14 @@
+// Copyright 2016 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.
+
+// Input for TestIssue13566
+
+package a
+
+import "encoding/json"
+
+type A struct {
+ a *A
+ json json.RawMessage
+}
diff --git a/internal/gcimporter/testdata/b.go b/internal/gcimporter/testdata/b.go
new file mode 100644
index 000000000..419667820
--- /dev/null
+++ b/internal/gcimporter/testdata/b.go
@@ -0,0 +1,11 @@
+// Copyright 2016 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.
+
+// Input for TestIssue13566
+
+package b
+
+import "./a"
+
+type A a.A
diff --git a/internal/gcimporter/testdata/exports.go b/internal/gcimporter/testdata/exports.go
new file mode 100644
index 000000000..8ee28b094
--- /dev/null
+++ b/internal/gcimporter/testdata/exports.go
@@ -0,0 +1,89 @@
+// Copyright 2011 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.
+
+// This file is used to generate an object file which
+// serves as test file for gcimporter_test.go.
+
+package exports
+
+import (
+ "go/ast"
+)
+
+// Issue 3682: Correctly read dotted identifiers from export data.
+const init1 = 0
+
+func init() {}
+
+const (
+ C0 int = 0
+ C1 = 3.14159265
+ C2 = 2.718281828i
+ C3 = -123.456e-789
+ C4 = +123.456E+789
+ C5 = 1234i
+ C6 = "foo\n"
+ C7 = `bar\n`
+)
+
+type (
+ T1 int
+ T2 [10]int
+ T3 []int
+ T4 *int
+ T5 chan int
+ T6a chan<- int
+ T6b chan (<-chan int)
+ T6c chan<- (chan int)
+ T7 <-chan *ast.File
+ T8 struct{}
+ T9 struct {
+ a int
+ b, c float32
+ d []string `go:"tag"`
+ }
+ T10 struct {
+ T8
+ T9
+ _ *T10
+ }
+ T11 map[int]string
+ T12 interface{}
+ T13 interface {
+ m1()
+ m2(int) float32
+ }
+ T14 interface {
+ T12
+ T13
+ m3(x ...struct{}) []T9
+ }
+ T15 func()
+ T16 func(int)
+ T17 func(x int)
+ T18 func() float32
+ T19 func() (x float32)
+ T20 func(...interface{})
+ T21 struct{ next *T21 }
+ T22 struct{ link *T23 }
+ T23 struct{ link *T22 }
+ T24 *T24
+ T25 *T26
+ T26 *T27
+ T27 *T25
+ T28 func(T28) T28
+)
+
+var (
+ V0 int
+ V1 = -991.0
+)
+
+func F1() {}
+func F2(x int) {}
+func F3() int { return 0 }
+func F4() float32 { return 0 }
+func F5(a, b, c int, u, v, w struct{ x, y T1 }, more ...interface{}) (p, q, r chan<- T10)
+
+func (p *T1) M1()
diff --git a/internal/gcimporter/testdata/issue15920.go b/internal/gcimporter/testdata/issue15920.go
new file mode 100644
index 000000000..c70f7d826
--- /dev/null
+++ b/internal/gcimporter/testdata/issue15920.go
@@ -0,0 +1,11 @@
+// Copyright 2016 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.
+
+package p
+
+// The underlying type of Error is the underlying type of error.
+// Make sure we can import this again without problems.
+type Error error
+
+func F() Error { return nil }
diff --git a/internal/gcimporter/testdata/issue20046.go b/internal/gcimporter/testdata/issue20046.go
new file mode 100644
index 000000000..c63ee821c
--- /dev/null
+++ b/internal/gcimporter/testdata/issue20046.go
@@ -0,0 +1,9 @@
+// Copyright 2017 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.
+
+package p
+
+var V interface {
+ M()
+}
diff --git a/internal/gcimporter/testdata/issue25301.go b/internal/gcimporter/testdata/issue25301.go
new file mode 100644
index 000000000..e3dc98b4e
--- /dev/null
+++ b/internal/gcimporter/testdata/issue25301.go
@@ -0,0 +1,17 @@
+// Copyright 2018 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.
+
+package issue25301
+
+type (
+ A = interface {
+ M()
+ }
+ T interface {
+ A
+ }
+ S struct{}
+)
+
+func (S) M() { println("m") }
diff --git a/internal/gcimporter/testdata/issue51836/a.go b/internal/gcimporter/testdata/issue51836/a.go
new file mode 100644
index 000000000..e9223c9aa
--- /dev/null
+++ b/internal/gcimporter/testdata/issue51836/a.go
@@ -0,0 +1,8 @@
+// Copyright 2022 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.
+
+package a
+
+type T[K any] struct {
+}
diff --git a/internal/gcimporter/testdata/issue51836/a/a.go b/internal/gcimporter/testdata/issue51836/a/a.go
new file mode 100644
index 000000000..e9223c9aa
--- /dev/null
+++ b/internal/gcimporter/testdata/issue51836/a/a.go
@@ -0,0 +1,8 @@
+// Copyright 2022 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.
+
+package a
+
+type T[K any] struct {
+}
diff --git a/internal/gcimporter/testdata/issue51836/aa.go b/internal/gcimporter/testdata/issue51836/aa.go
new file mode 100644
index 000000000..d774be282
--- /dev/null
+++ b/internal/gcimporter/testdata/issue51836/aa.go
@@ -0,0 +1,13 @@
+// Copyright 2022 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.
+
+package a
+
+import (
+ "./a"
+)
+
+type T[K any] struct {
+ t a.T[K]
+}
diff --git a/internal/gcimporter/testdata/issue57015.go b/internal/gcimporter/testdata/issue57015.go
new file mode 100644
index 000000000..b6be81191
--- /dev/null
+++ b/internal/gcimporter/testdata/issue57015.go
@@ -0,0 +1,16 @@
+// Copyright 2022 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.
+
+package issue57015
+
+type E error
+
+type X[T any] struct {}
+
+func F() X[interface {
+ E
+}] {
+ panic(0)
+}
+
diff --git a/internal/gcimporter/testdata/issue58296/a/a.go b/internal/gcimporter/testdata/issue58296/a/a.go
new file mode 100644
index 000000000..236978a5c
--- /dev/null
+++ b/internal/gcimporter/testdata/issue58296/a/a.go
@@ -0,0 +1,9 @@
+// Copyright 2023 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.
+
+package a
+
+type A int
+
+func (A) f() {}
diff --git a/internal/gcimporter/testdata/issue58296/b/b.go b/internal/gcimporter/testdata/issue58296/b/b.go
new file mode 100644
index 000000000..8886ca571
--- /dev/null
+++ b/internal/gcimporter/testdata/issue58296/b/b.go
@@ -0,0 +1,11 @@
+// Copyright 2023 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.
+
+package b
+
+import "./a"
+
+type B struct {
+ a a.A
+}
diff --git a/internal/gcimporter/testdata/issue58296/c/c.go b/internal/gcimporter/testdata/issue58296/c/c.go
new file mode 100644
index 000000000..bad8be81d
--- /dev/null
+++ b/internal/gcimporter/testdata/issue58296/c/c.go
@@ -0,0 +1,11 @@
+// Copyright 2023 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.
+
+package c
+
+import "./b"
+
+type C struct {
+ b b.B
+}
diff --git a/internal/gcimporter/testdata/p.go b/internal/gcimporter/testdata/p.go
new file mode 100644
index 000000000..9e2e70576
--- /dev/null
+++ b/internal/gcimporter/testdata/p.go
@@ -0,0 +1,13 @@
+// Copyright 2016 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.
+
+// Input for TestIssue15517
+
+package p
+
+const C = 0
+
+var V int
+
+func F() {}
diff --git a/internal/gcimporter/testdata/versions/test.go b/internal/gcimporter/testdata/versions/test.go
new file mode 100644
index 000000000..6362adc21
--- /dev/null
+++ b/internal/gcimporter/testdata/versions/test.go
@@ -0,0 +1,30 @@
+// Copyright 2016 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.
+
+// This file is a copy of $GOROOT/src/go/internal/gcimporter/testdata/versions.test.go.
+
+// To create a test case for a new export format version,
+// build this package with the latest compiler and store
+// the resulting .a file appropriately named in the versions
+// directory. The VersionHandling test will pick it up.
+//
+// In the testdata/versions:
+//
+// go build -o test_go1.$X_$Y.a test.go
+//
+// with $X = Go version and $Y = export format version
+// (add 'b' or 'i' to distinguish between binary and
+// indexed format starting with 1.11 as long as both
+// formats are supported).
+//
+// Make sure this source is extended such that it exercises
+// whatever export format change has taken place.
+
+package test
+
+// Any release before and including Go 1.7 didn't encode
+// the package for a blank struct field.
+type BlankField struct {
+ _ int
+}
diff --git a/internal/gcimporter/testdata/versions/test_go1.11_0i.a b/internal/gcimporter/testdata/versions/test_go1.11_0i.a
new file mode 100644
index 000000000..b00fefed0
--- /dev/null
+++ b/internal/gcimporter/testdata/versions/test_go1.11_0i.a
Binary files differ
diff --git a/internal/gcimporter/testdata/versions/test_go1.11_6b.a b/internal/gcimporter/testdata/versions/test_go1.11_6b.a
new file mode 100644
index 000000000..c0a211e91
--- /dev/null
+++ b/internal/gcimporter/testdata/versions/test_go1.11_6b.a
Binary files differ
diff --git a/internal/gcimporter/testdata/versions/test_go1.11_999b.a b/internal/gcimporter/testdata/versions/test_go1.11_999b.a
new file mode 100644
index 000000000..c35d22dce
--- /dev/null
+++ b/internal/gcimporter/testdata/versions/test_go1.11_999b.a
Binary files differ
diff --git a/internal/gcimporter/testdata/versions/test_go1.11_999i.a b/internal/gcimporter/testdata/versions/test_go1.11_999i.a
new file mode 100644
index 000000000..99401d7c3
--- /dev/null
+++ b/internal/gcimporter/testdata/versions/test_go1.11_999i.a
Binary files differ
diff --git a/internal/gcimporter/testdata/versions/test_go1.7_0.a b/internal/gcimporter/testdata/versions/test_go1.7_0.a
new file mode 100644
index 000000000..edb6c3f25
--- /dev/null
+++ b/internal/gcimporter/testdata/versions/test_go1.7_0.a
Binary files differ
diff --git a/internal/gcimporter/testdata/versions/test_go1.7_1.a b/internal/gcimporter/testdata/versions/test_go1.7_1.a
new file mode 100644
index 000000000..554d04a72
--- /dev/null
+++ b/internal/gcimporter/testdata/versions/test_go1.7_1.a
Binary files differ
diff --git a/internal/gcimporter/testdata/versions/test_go1.8_4.a b/internal/gcimporter/testdata/versions/test_go1.8_4.a
new file mode 100644
index 000000000..26b853165
--- /dev/null
+++ b/internal/gcimporter/testdata/versions/test_go1.8_4.a
Binary files differ
diff --git a/internal/gcimporter/testdata/versions/test_go1.8_5.a b/internal/gcimporter/testdata/versions/test_go1.8_5.a
new file mode 100644
index 000000000..60e52efea
--- /dev/null
+++ b/internal/gcimporter/testdata/versions/test_go1.8_5.a
Binary files differ