1
0
mirror of https://github.com/golang/go synced 2024-11-26 05:07:59 -07:00

[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 <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
This commit is contained in:
Dan Scales 2021-07-18 11:10:41 -07:00
parent 3dc0a0a2c5
commit a2e2b0362b
2 changed files with 19 additions and 2 deletions

View File

@ -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()

View File

@ -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(