diff options
author | Robert Griesemer <gri@golang.org> | 2021-07-11 15:59:22 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-07-14 23:33:51 +0000 |
commit | 3a047326e896302724378e5d6b8684851ccfdbfd (patch) | |
tree | 55ca84d77503db96ccddbe8955848887ec406203 /src/cmd/compile/internal/types2/testdata | |
parent | dd8bdf4a1fceb06231eb73c026f4a7fe41f00dc1 (diff) | |
download | go-3a047326e896302724378e5d6b8684851ccfdbfd.tar.gz go-3a047326e896302724378e5d6b8684851ccfdbfd.zip |
[dev.typeparams] cmd/compile/internal/types2: fix generic type indirection
Change-Id: If25ceb2aa403b94608760be331faa2aff11c47cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/333890
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/testdata')
-rw-r--r-- | src/cmd/compile/internal/types2/testdata/examples/operations.go2 | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/types2/testdata/examples/operations.go2 b/src/cmd/compile/internal/types2/testdata/examples/operations.go2 new file mode 100644 index 0000000000..18e4d6080c --- /dev/null +++ b/src/cmd/compile/internal/types2/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 +} |