diff options
Diffstat (limited to 'src/internal/types/testdata/examples/operations.go')
-rw-r--r-- | src/internal/types/testdata/examples/operations.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/internal/types/testdata/examples/operations.go b/src/internal/types/testdata/examples/operations.go new file mode 100644 index 0000000..18e4d60 --- /dev/null +++ b/src/internal/types/testdata/examples/operations.go @@ -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 +} |