]> Cypherpunks repositories - gostls13.git/commitdiff
go/types: review of call.go
authorRob Findley <rfindley@google.com>
Tue, 23 Feb 2021 17:01:26 +0000 (12:01 -0500)
committerRobert Findley <rfindley@google.com>
Wed, 24 Feb 2021 12:37:13 +0000 (12:37 +0000)
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 <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/types/call.go

index b502122a26aeef37b1c4754ad7d72360fb737b32..e56f74137063a8161d9bb3f50f43579011ce126b 100644 (file)
@@ -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))
        }