From 8960ce773549007f80e6ebd7a9f6c642308087b9 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 18 Feb 2021 09:12:19 -0800 Subject: [PATCH] [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 Reviewed-by: Robert Findley --- src/cmd/compile/internal/types2/call.go | 9 ++++----- src/cmd/compile/internal/types2/typexpr.go | 2 -- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/cmd/compile/internal/types2/call.go b/src/cmd/compile/internal/types2/call.go index 67a76d14fb..72805c453b 100644 --- a/src/cmd/compile/internal/types2/call.go +++ b/src/cmd/compile/internal/types2/call.go @@ -17,15 +17,15 @@ import ( // 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) { 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 { x.mode = invalid x.expr = inst 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 n := len(args) @@ -77,7 +77,6 @@ func (check *Checker) funcInst(x *operand, inst *syntax.IndexExpr) { assert(targ != nil) } } - //check.dump("### inferred targs = %s", targs) n = len(targs) inferred = true } diff --git a/src/cmd/compile/internal/types2/typexpr.go b/src/cmd/compile/internal/types2/typexpr.go index 87eabbe28d..7190cb446a 100644 --- a/src/cmd/compile/internal/types2/typexpr.go +++ b/src/cmd/compile/internal/types2/typexpr.go @@ -1204,8 +1204,6 @@ func embeddedFieldIdent(e syntax.Expr) *syntax.Name { return e.Sel case *syntax.IndexExpr: return embeddedFieldIdent(e.X) - case *syntax.ParenExpr: - return embeddedFieldIdent(e.X) } return nil // invalid embedded field }