go/test/fixedbugs/issue20789.go
Robert Griesemer c801e4b10f 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>
2022-09-01 22:37:03 +00:00

13 lines
444 B
Go

// errorcheck
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Make sure this doesn't crash the compiler.
// (This test should be part of the internal/syntax
// package, but we don't have a general test framework
// there yet, so put it here for now. See also #20800.)
package e
func([<-chan<-[func u){go // ERROR "unexpected u"