diff options
| author | Robert Griesemer <gri@golang.org> | 2021-08-31 17:43:18 -0700 |
|---|---|---|
| committer | Robert Griesemer <gri@golang.org> | 2021-09-01 23:41:53 +0000 |
| commit | 2872496ba528d658b68a9e66f46b2b722368a3bb (patch) | |
| tree | 3150e0a0c58baa7d29216add100e03d79ec62403 /src/syscall/exec_linux.go | |
| parent | 0bfd6fcea6b7cefe200718dc3b318e1d13ee03ab (diff) | |
| download | go-2872496ba528d658b68a9e66f46b2b722368a3bb.tar.xz | |
cmd/compile/internal/types2: systematic detection of missing instantiation
When type-checking expressions, detection of uninstantiated generic
functions and types was somewhat ad-hoc.
Add an extra parameter "allowGenerics" to rawExpr. If not set, the
result operand cannot be generic.
The only place where rawExpr is called with allowGenerics != false
is from exprOrType, which passes an allowGenerics parameter through.
The only place where exprOrType is called with allowGenerics == true
is when handling index expressions and calls. Make sure that we only
accept generic operands where expected, and check the other branches.
As a result, a recently added varType call (CL 345970) can be removed
again.
This also fixes a bug where an error for a conversion to generic
type was reported after the conversion (i.e., with the converted
value, rather than the generic type). Added a test case for that.
For #48048.
Change-Id: I8576326f5fcfb58d78b3ce8572068aa32e66c568
Reviewed-on: https://go-review.googlesource.com/c/go/+/346471
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/syscall/exec_linux.go')
0 files changed, 0 insertions, 0 deletions
