From 26001d109ed3da33c728b96e547fa380c7e2a300 Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Tue, 23 Feb 2021 12:01:26 -0500 Subject: [PATCH] go/types: review of call.go The changes from the (reviewed) dev.regabi copy of call.go can be seen by comparing patchset 1 and 4. The actual changes are removing the "// REVIEW INCOMPLETE" marker, deleting some leftover handling of type instantiation in Checker.call, and adding a comment that exprOrTypeList should be refactored. I started to refactor exprOrTypeList, but thought it best to mark this code as reviewed before diverging from types2. Change-Id: Icf7fbff5a8def49c5f1781472fd7ba7b73dd9a9c Reviewed-on: https://go-review.googlesource.com/c/go/+/295531 Trust: Robert Findley Trust: Robert Griesemer Run-TryBot: Robert Findley TryBot-Result: Go Bot Reviewed-by: Robert Griesemer --- src/go/types/call.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/go/types/call.go b/src/go/types/call.go index b502122a26a..e56f7413706 100644 --- a/src/go/types/call.go +++ b/src/go/types/call.go @@ -1,4 +1,3 @@ -// REVIEW INCOMPLETE // Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -114,19 +113,9 @@ func (check *Checker) call(x *operand, call *ast.CallExpr) exprKind { return statement case typexpr: - // conversion or type instantiation + // conversion T := x.typ x.mode = invalid - if isGeneric(T) { - // type instantiation - x.typ = check.typ(call) - if x.typ != Typ[Invalid] { - x.mode = typexpr - } - return expression - } - - // conversion switch n := len(call.Args); n { case 0: check.errorf(inNode(call, call.Rparen), _WrongArgCount, "missing argument in conversion to %s", T) @@ -217,6 +206,7 @@ func (check *Checker) call(x *operand, call *ast.CallExpr) exprKind { // exprOrTypeList returns a list of operands and reports an error if the // list contains a mix of values and types (ignoring invalid operands). +// TODO(rFindley) Now we can split this into exprList and typeList. func (check *Checker) exprOrTypeList(elist []ast.Expr) (xlist []*operand, ok bool) { ok = true @@ -437,8 +427,6 @@ func (check *Checker) arguments(call *ast.CallExpr, sig *Signature, args []*oper } // check arguments - // TODO(gri) Possible optimization (may be tricky): We could avoid - // checking arguments from which we inferred type arguments. for i, a := range args { check.assignment(a, sigParams.vars[i].typ, check.sprintf("argument to %s", call.Fun)) }