aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/typexpr.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2020-12-10 18:07:09 -0800
committerRobert Griesemer <gri@golang.org>2020-12-14 21:29:46 +0000
commit8fe8e29c9f94d569586a6d8ae6798f82bb5b385b (patch)
tree58d6b0fda7db7d9e179db731723ac708889d61a5 /src/cmd/compile/internal/types2/typexpr.go
parentf8930a241301b9922beef925e4ca685f8c3e95a7 (diff)
downloadgo-8fe8e29c9f94d569586a6d8ae6798f82bb5b385b.tar.gz
go-8fe8e29c9f94d569586a6d8ae6798f82bb5b385b.zip
[dev.typeparams] cmd/compile/internal/types2: report error for invalid type expression
This bug was introduced by the change from go/ast to syntax which represents pointer types as (unary) operations rather than dedicated StarExpr nodes. Accordingly, this bug does not exist for go/types. It's still ok to backport the test. Fixes #43125. Change-Id: Ic55d913f8afc92862856e1eb7c2861d07fc56cfb Reviewed-on: https://go-review.googlesource.com/c/go/+/278013 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/types2/typexpr.go')
-rw-r--r--src/cmd/compile/internal/types2/typexpr.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/types2/typexpr.go b/src/cmd/compile/internal/types2/typexpr.go
index 22df01b3be..4231577a4f 100644
--- a/src/cmd/compile/internal/types2/typexpr.go
+++ b/src/cmd/compile/internal/types2/typexpr.go
@@ -535,6 +535,9 @@ func (check *Checker) typInternal(e0 syntax.Expr, def *Named) (T Type) {
return typ
}
+ check.errorf(e0, "%s is not a type", e0)
+ check.use(e0)
+
case *syntax.FuncType:
typ := new(Signature)
def.setUnderlying(typ)