mirror of
https://github.com/golang/go
synced 2024-11-26 17:16:54 -07:00
0775730180
For syntax errors in various (syntactic) lists, instead of reporting a set of "expected" tokens (which may be incomplete), provide context and mention "possibly missing" tokens. The result is a friendlier and more accurate error message. Fixes #49205. Change-Id: I38ae7bf62febfe790075e62deb33ec8c17d64476 Reviewed-on: https://go-review.googlesource.com/c/go/+/396914 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
19 lines
423 B
Go
19 lines
423 B
Go
// errorcheck
|
|
|
|
// Copyright 2015 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.
|
|
|
|
package main
|
|
|
|
func f(int, int) {
|
|
switch x {
|
|
case 1:
|
|
f(1, g() // ERROR "expecting \)|possibly missing comma or \)"
|
|
case 2:
|
|
f()
|
|
case 3:
|
|
f(1, g() // ERROR "expecting \)|possibly missing comma or \)"
|
|
}
|
|
}
|