Fixes #75863
Change-Id: I1e5a0f3880dcd5f820a5b6f4540c49b16a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/711141
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
switch n1 := n.(type) {
case *ir.ConvExpr:
if n1.Op() == ir.OCONVNOP {
- if !n1.Type().IsInterface() || !types.Identical(n1.Type(), n1.X.Type()) {
+ if !n1.Type().IsInterface() || !types.Identical(n1.Type().Underlying(), n1.X.Type().Underlying()) {
// As we check (directly before this switch) whether n is an interface, thus we should only reach
// here for iface conversions where both operands are the same.
base.Fatalf("not identical/interface types found n1.Type = %v; n1.X.Type = %v", n1.Type(), n1.X.Type())
var a A = (implWrapper)(i) // ERROR "implWrapper\(i\) does not escape$"
a.A() // ERROR "devirtualizing a.A to implWrapper$" "inlining call to implWrapper.A"
}
+ {
+ type anyWrapper any
+ var foo any = &Impl{} // ERROR "&Impl\{\} does not escape"
+ var bar anyWrapper = foo
+ bar.(M).M() // ERROR "devirtualizing bar\.\(M\).M to \*Impl" "inlining call to \(\*Impl\)\.M"
+ }
}
func selfAssigns() {