[dev.typeparams] cmd/compile: fix HasShape, add dottype test

HasShape needs a TINTER case.

Add a test for x.(T) in various situations. Needs the fix above.

Also remove ONEW unshapify case. It is ok for ONEW to have a shape
type, as it will just be passed to mallocgc, or possibly used as a
stack object type, both of which are ok.

Change-Id: Ibddf8f5c8c254d32cb5ebcaca7dc94b4c00ab893
Reviewed-on: https://go-review.googlesource.com/c/go/+/337231
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
Keith Randall 2021-07-24 14:11:27 -07:00
parent a2e2b0362b
commit b27c7e30dc
4 changed files with 96 additions and 7 deletions

View file

@ -1376,12 +1376,6 @@ func (subst *subster) node(n ir.Node) ir.Node {
case ir.ODOTTYPE, ir.ODOTTYPE2:
m.SetType(subst.unshapifyTyp(m.Type()))
case ir.ONEW:
// New needs to pass a concrete type to the runtime.
// Or maybe it doesn't? We could use a shape type.
// TODO: need to modify m.X? I don't think any downstream passes use it.
m.SetType(subst.unshapifyTyp(m.Type()))
case ir.OMETHEXPR:
se := m.(*ir.SelectorExpr)
se.X = ir.TypeNodeAt(se.X.Pos(), subst.unshapifyTyp(se.X.Type()))