From: Dan Scales Date: Sun, 18 Jul 2021 18:10:41 +0000 (-0700) Subject: [dev.typeparams] transformDot() should set Selection and tc flag for added ODOTs X-Git-Tag: go1.18beta1~1818^2^2~104 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a2e2b0362bb2e7b93de668007027d08888bc9a38;p=gostls13.git [dev.typeparams] transformDot() should set Selection and tc flag for added ODOTs Fixes -G=3 issue with issue44688.go. Change-Id: Ie98c0cbd48683dedd115332043f14c8f3160f46c Reviewed-on: https://go-review.googlesource.com/c/go/+/337029 Run-TryBot: Dan Scales TryBot-Result: Go Bot Reviewed-by: Keith Randall Trust: Dan Scales --- diff --git a/src/cmd/compile/internal/noder/transform.go b/src/cmd/compile/internal/noder/transform.go index f89ae13237..2fe55a6852 100644 --- a/src/cmd/compile/internal/noder/transform.go +++ b/src/cmd/compile/internal/noder/transform.go @@ -591,6 +591,24 @@ func transformDot(n *ir.SelectorExpr, isCall bool) ir.Node { if n.Op() == ir.OXDOT { n = typecheck.AddImplicitDots(n) n.SetOp(ir.ODOT) + + // Set the Selection field and typecheck flag for any new ODOT nodes + // added by AddImplicitDots(), and also transform to ODOTPTR if + // needed. Equivalent to 'n.X = typecheck(n.X, ctxExpr|ctxType)' in + // tcDot. + for n1 := n; n1.X.Op() == ir.ODOT; { + n1 = n1.X.(*ir.SelectorExpr) + if !n1.Implicit() { + break + } + t1 := n1.X.Type() + if t1.IsPtr() && !t1.Elem().IsInterface() { + t1 = t1.Elem() + n1.SetOp(ir.ODOTPTR) + } + typecheck.Lookdot(n1, t1, 0) + n1.SetTypecheck(1) + } } t := n.X.Type() diff --git a/test/run.go b/test/run.go index 5624654fec..1e7fab4359 100644 --- a/test/run.go +++ b/test/run.go @@ -2185,8 +2185,7 @@ var g3Failures = setOf( "typeparam/mdempsky/4.go", // -G=3 can't export functions with labeled breaks in loops "typeparam/mdempsky/13.go", // problem with interface as as a type arg. - "typeparam/cons.go", // causes an unreachable method - "typeparam/issue44688.go", // interface conversion fails due to missing method + "typeparam/cons.go", // causes an unreachable method ) var unifiedFailures = setOf(