Commit graph

2 commits

Author SHA1 Message Date
Robert Griesemer c25bf0d959 cmd/compile/internal/types2: report types for mismatched call and return statements
Thanks to emmanuel@orijtech.com who wrote the initial version of
this change (CL 354490).

This change is following CL 354490 in idea but also contains various
simplifications, slightly improved printing of signature/type patterns,
adjustments for types2, and some fine-tuning of error positions.

Also adjusted several ERROR regexp patterns.

Fixes #48834.
Fixes #48835.

Change-Id: I31cf20c81753b1dc84836dbe83a39030ceb9db23
Reviewed-on: https://go-review.googlesource.com/c/go/+/364874
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-11-24 20:57:46 +00:00
Cuong Manh Le fd4b587da3 cmd/compile: suppress details error for invalid variadic argument type
CL 255241 made error message involving variadic calls clearer. To do it,
we added a check that the type of variadic argument must be a slice.
That's why the compiler crashes for invalid variadic argument type.

Instead, we can just omit the details error message, and report not
enough arguments error, which matches the behavior of go/types and types2.

Fixes #46957

Change-Id: I638d7e8f031f0ee344d5d802104fd93a60aae00a
Reviewed-on: https://go-review.googlesource.com/c/go/+/331569
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-06-29 04:38:12 +00:00