go/types: return an error message from Checker.genericType
The bare error message "%s is not a generic type" is probably never
sufficient, so change the signature of genericType to instead return an
message that may be formatted as additional context in errors.
Along the way, refactor instantiatedType to have access to the entire
index expression.
Fixes #48827
Change-Id: I0c455c1ce46ac3f1ef2990c997da19e5fc6c4eae
Reviewed-on: https://go-review.googlesource.com/c/go/+/363994
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>