mirror of
https://github.com/golang/go
synced 2024-11-24 20:40:23 -07:00
923740a8cc
For type assertions, if src type is empty interface, we should use normal type assertions rather than dynamic type assertions. Fixes #53762 Change-Id: I596b2e4ad647fe5e42ad884f7273c78f8f50dac2 Reviewed-on: https://go-review.googlesource.com/c/go/+/416736 Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
19 lines
304 B
Go
19 lines
304 B
Go
// 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 Value[T any] interface {
|
|
}
|
|
|
|
func use[T any](v Value[T]) {
|
|
_, _ = v.(int)
|
|
}
|
|
|
|
func main() {
|
|
use(Value[int](1))
|
|
}
|