go/types, types2: don't panic when instantiating generic alias with wrong number of type arguments
The existing code assumed the type argument count check in
Checker.instance couldn't fail for generic alias types
(matching the code for generic signatures), but it actually
can.
Adjust the code accordingly and document that the result of
Checker.instance may be invalid.
Review all call sites of Checker.instance and make sure we
handle the failure case, or document the code accordingly
(in the case of generic signatures).
When reporting an type argument count error, use the alias
name rather than the alias string representation to match
the error we get for a non-alias type.
While at it, update the manual.go template for ease of use.
Fixes #71198.
Change-Id: I6d19ec6418440e9b49574a2d7dd9825e0af6c2fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/641857 Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>