mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.typeparams] go/types: fix some merge errors in call.go
Some comments were left unresolved in the merge of call.go. Resolve them to get tests to pass (tests to be added in a later CL). Change-Id: Icf894593e7dd5131406c4eece8d43d4cd3170d1c Reviewed-on: https://go-review.googlesource.com/c/go/+/284255 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> Trust: Robert Griesemer <gri@golang.org> Trust: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
3e15bf7716
commit
48a3cb399d
1 changed files with 12 additions and 14 deletions
|
|
@ -116,9 +116,7 @@ func (check *Checker) call(x *operand, call *ast.CallExpr, orig ast.Expr) exprKi
|
||||||
// If the first argument is a type, assume we have explicit type arguments.
|
// If the first argument is a type, assume we have explicit type arguments.
|
||||||
|
|
||||||
// check number of type arguments
|
// check number of type arguments
|
||||||
// TODO(rFindley)
|
if n > len(sig.tparams) {
|
||||||
// if !check.conf.InferFromConstraints && n != len(sig.tparams) || n > len(sig.tparams) {
|
|
||||||
if n != len(sig.tparams) || n > len(sig.tparams) {
|
|
||||||
check.errorf(args[n-1], 0, "got %d type arguments but want %d", n, len(sig.tparams))
|
check.errorf(args[n-1], 0, "got %d type arguments but want %d", n, len(sig.tparams))
|
||||||
x.mode = invalid
|
x.mode = invalid
|
||||||
x.expr = orig
|
x.expr = orig
|
||||||
|
|
@ -127,7 +125,8 @@ func (check *Checker) call(x *operand, call *ast.CallExpr, orig ast.Expr) exprKi
|
||||||
|
|
||||||
// collect types
|
// collect types
|
||||||
targs := make([]Type, n)
|
targs := make([]Type, n)
|
||||||
// TODO(rFindley) positioner?
|
// TODO(rFindley) use a positioner here? instantiate would need to be
|
||||||
|
// updated accordingly.
|
||||||
poslist := make([]token.Pos, n)
|
poslist := make([]token.Pos, n)
|
||||||
for i, a := range args {
|
for i, a := range args {
|
||||||
if a.mode != typexpr {
|
if a.mode != typexpr {
|
||||||
|
|
@ -192,7 +191,11 @@ func (check *Checker) call(x *operand, call *ast.CallExpr, orig ast.Expr) exprKi
|
||||||
return expression
|
return expression
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we reach here, orig must have been a regular call, not an index expression.
|
// If we reach here, orig must have been a regular call, not an index
|
||||||
|
// expression.
|
||||||
|
// TODO(rFindley) with a manually constructed AST it is possible to reach
|
||||||
|
// this assertion. We should return an invalidAST error here
|
||||||
|
// rather than panicking.
|
||||||
assert(!call.Brackets)
|
assert(!call.Brackets)
|
||||||
|
|
||||||
sig = check.arguments(call, sig, args)
|
sig = check.arguments(call, sig, args)
|
||||||
|
|
@ -411,15 +414,10 @@ func (check *Checker) arguments(call *ast.CallExpr, sig *Signature, args []*oper
|
||||||
if failed >= 0 {
|
if failed >= 0 {
|
||||||
// Some type arguments couldn't be inferred. Use
|
// Some type arguments couldn't be inferred. Use
|
||||||
// bounds type inference to try to make progress.
|
// bounds type inference to try to make progress.
|
||||||
// TODO(rFindley)
|
|
||||||
/*
|
|
||||||
if check.conf.InferFromConstraints {
|
|
||||||
targs, failed = check.inferB(sig.tparams, targs)
|
targs, failed = check.inferB(sig.tparams, targs)
|
||||||
if targs == nil {
|
if targs == nil {
|
||||||
return // error already reported
|
return // error already reported
|
||||||
}
|
}
|
||||||
}
|
|
||||||
*/
|
|
||||||
if failed >= 0 {
|
if failed >= 0 {
|
||||||
// at least one type argument couldn't be inferred
|
// at least one type argument couldn't be inferred
|
||||||
assert(targs[failed] == nil)
|
assert(targs[failed] == nil)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue