]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/syntax: use BadExpr instead of fake CallExpr in bad go/defer
authorRobert Griesemer <gri@golang.org>
Thu, 25 Aug 2022 23:14:43 +0000 (16:14 -0700)
committerGopher Robot <gobot@golang.org>
Thu, 1 Sep 2022 22:37:03 +0000 (22:37 +0000)
commitc801e4b10f708c180a3708bcf39881338691287c
treeb27e7128f8e9cc16dc2aa9fd473ef2a2c4e79673
parent9b80d3d3db126bda3eb976778cca4eb03a5a229b
cmd/compile/internal/syntax: use BadExpr instead of fake CallExpr in bad go/defer

If the go/defer syntax is bad, using a fake CallExpr may produce
a follow-on error in the type checker. Instead store a BadExpr
in the syntax tree (since an error has already been reported).

Adjust various tests.

For #54511.

Change-Id: Ib2d25f8eab7d5745275188d83d11620cad6ef47c
Reviewed-on: https://go-review.googlesource.com/c/go/+/425675
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
src/cmd/compile/internal/syntax/nodes.go
src/cmd/compile/internal/syntax/parser.go
src/cmd/compile/internal/syntax/testdata/issue20789.go
src/cmd/compile/internal/types2/stmt.go
src/cmd/compile/internal/types2/testdata/check/stmt0.go
test/fixedbugs/issue20789.go
test/fixedbugs/issue23586.go