diff options
author | Wayne Zuo <wdvxdr@golangcn.org> | 2022-07-31 17:20:26 +0800 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2022-08-01 20:18:37 +0000 |
commit | 27038b70f860e29fdf472ac5fb208b6ad9598c10 (patch) | |
tree | 5a41b0afebb8dd6fcae5e2005ccd55e3e502fe0b /test/typeparam | |
parent | e99f53fed98b0378c147588789b8c56b0305469b (diff) | |
download | go-27038b70f860e29fdf472ac5fb208b6ad9598c10.tar.gz go-27038b70f860e29fdf472ac5fb208b6ad9598c10.zip |
cmd/compile: fix wrong dict pass condition for type assertions
Fixes #54135
Change-Id: I2b27af8124014b2699ea44bdc765e1fb8f6c8028
Reviewed-on: https://go-review.googlesource.com/c/go/+/420394
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'test/typeparam')
-rw-r--r-- | test/typeparam/issue54135.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/typeparam/issue54135.go b/test/typeparam/issue54135.go new file mode 100644 index 0000000000..dffef60d0d --- /dev/null +++ b/test/typeparam/issue54135.go @@ -0,0 +1,28 @@ +// compile + +// 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 main + +type Foo struct{} + +func (Foo) Blanker() {} + +type Bar[T any] interface { + Blanker() +} + +type Baz interface { + Some() +} + +func check[T comparable](p Bar[T]) { + _, _ = p.(any) + _, _ = p.(Baz) +} + +func main() { + check[int](Foo{}) +} |