aboutsummaryrefslogtreecommitdiff
path: root/src/go/types/testdata/examples/operations.go2
diff options
context:
space:
mode:
Diffstat (limited to 'src/go/types/testdata/examples/operations.go2')
-rw-r--r--src/go/types/testdata/examples/operations.go229
1 files changed, 29 insertions, 0 deletions
diff --git a/src/go/types/testdata/examples/operations.go2 b/src/go/types/testdata/examples/operations.go2
new file mode 100644
index 0000000000..18e4d6080c
--- /dev/null
+++ b/src/go/types/testdata/examples/operations.go2
@@ -0,0 +1,29 @@
+// Copyright 2021 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
+
+// indirection
+
+func _[P any](p P) {
+ _ = *p // ERROR cannot indirect p
+}
+
+func _[P interface{ int }](p P) {
+ _ = *p // ERROR cannot indirect p
+}
+
+func _[P interface{ *int }](p P) {
+ _ = *p
+}
+
+func _[P interface{ *int | *string }](p P) {
+ _ = *p // ERROR must have identical base types
+}
+
+type intPtr *int
+
+func _[P interface{ *int | intPtr } ](p P) {
+ var _ int = *p
+}