1
0
mirror of https://github.com/golang/go synced 2024-11-23 15:00:03 -07:00

[dev.typeparams] cmd/compile/internal/types2: minor adjustments to match go/types more closely

Change-Id: Ib0144e0dd33e9202037e461a85f72f5db08ebd3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/293631
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Robert Griesemer 2021-02-18 09:12:19 -08:00
parent 6f3878b942
commit 8960ce7735
2 changed files with 4 additions and 7 deletions

View File

@ -17,15 +17,15 @@ import (
// The operand x must be the evaluation of inst.X and its type must be a signature. // The operand x must be the evaluation of inst.X and its type must be a signature.
func (check *Checker) funcInst(x *operand, inst *syntax.IndexExpr) { func (check *Checker) funcInst(x *operand, inst *syntax.IndexExpr) {
args, ok := check.exprOrTypeList(unpackExpr(inst.Index)) args, ok := check.exprOrTypeList(unpackExpr(inst.Index))
if ok && len(args) > 0 && args[0].mode != typexpr {
check.errorf(args[0], "%s is not a type", args[0])
ok = false
}
if !ok { if !ok {
x.mode = invalid x.mode = invalid
x.expr = inst x.expr = inst
return return
} }
if len(args) > 0 && args[0].mode != typexpr {
check.errorf(args[0], "%s is not a type", args[0])
ok = false
}
// check number of type arguments // check number of type arguments
n := len(args) n := len(args)
@ -77,7 +77,6 @@ func (check *Checker) funcInst(x *operand, inst *syntax.IndexExpr) {
assert(targ != nil) assert(targ != nil)
} }
} }
//check.dump("### inferred targs = %s", targs)
n = len(targs) n = len(targs)
inferred = true inferred = true
} }

View File

@ -1204,8 +1204,6 @@ func embeddedFieldIdent(e syntax.Expr) *syntax.Name {
return e.Sel return e.Sel
case *syntax.IndexExpr: case *syntax.IndexExpr:
return embeddedFieldIdent(e.X) return embeddedFieldIdent(e.X)
case *syntax.ParenExpr:
return embeddedFieldIdent(e.X)
} }
return nil // invalid embedded field return nil // invalid embedded field
} }