mirror of
https://github.com/golang/go
synced 2024-11-22 09:44:40 -07:00
bd3f44e4ff
Retrying the original CL with a small modification. The original CL did not handle the case of reading an itab out of a dictionary correctly. When we read an itab out of a dictionary, we must treat the type inside that itab as maybe being put in an interface. Original CL: 486895 Revert CL: 490156 Change-Id: Id2dc1699d184cd8c63dac83986a70b60b4e6cbd7 Reviewed-on: https://go-review.googlesource.com/c/go/+/491495 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
29 lines
363 B
Go
29 lines
363 B
Go
// run
|
|
|
|
// Copyright 2023 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 S struct {
|
|
x int
|
|
}
|
|
|
|
func (t *S) M1() {
|
|
}
|
|
func (t *S) M2() {
|
|
}
|
|
|
|
type I interface {
|
|
M1()
|
|
}
|
|
|
|
func F[T I](x T) I {
|
|
return x
|
|
}
|
|
|
|
func main() {
|
|
F(&S{}).(interface{ M2() }).M2()
|
|
}
|