From ba0db5b4d1baa176e01b648862e2e758f89bc8ed Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Fri, 20 Apr 2018 17:03:29 +1000 Subject: [PATCH] Remove some hard coded bcheckExprOther checks --- lang/check/bounds.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lang/check/bounds.go b/lang/check/bounds.go index b874f40b..33510d38 100644 --- a/lang/check/bounds.go +++ b/lang/check/bounds.go @@ -854,10 +854,7 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (*big.Int, *big.Int, return nil, nil, nil } // TODO: delete this hack that only matches "foo.decode(etc)". - if isThatMethod(q.tm, n, q.tm.ByName("decode"), 2) || - isThatMethod(q.tm, n, q.tm.ByName("decode"), 3) || - isThatMethod(q.tm, n, t.IDCopyFromSlice, 1) || - isThatMethod(q.tm, n, q.tm.ByName("update"), 1) { + if isThatMethod(q.tm, n, q.tm.ByName("decode"), 3) { for _, o := range n.Args() { a := o.Arg().Value() aMin, aMax, err := q.bcheckExpr(a, depth) @@ -973,6 +970,10 @@ func (q *checker) bcheckExprCall(n *a.Expr, depth uint32) error { return err } inFields := f.In().Fields() + if len(inFields) != len(n.Args()) { + return fmt.Errorf("check: %q has %d arguments but %d were given", + lhs.MType().Str(q.tm), len(inFields), len(n.Args())) + } for i, o := range n.Args() { if err := q.bcheckAssignment2(nil, inFields[i].Field().XType(), t.IDEq, o.Arg().Value()); err != nil { return err