aboutsummaryrefslogtreecommitdiff
path: root/test/syntax
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2018-03-29 18:22:23 -0700
committerRobert Griesemer <gri@golang.org>2018-04-03 05:34:20 +0000
commitc65a2781be7a8029435ea3d6a3c54c601ac4ba3e (patch)
treeb7017c568143e1aca93a23af43603da4209e9be8 /test/syntax
parent071f0de4ec0d912b2908821466818ca2be04655c (diff)
downloadgo-c65a2781be7a8029435ea3d6a3c54c601ac4ba3e.tar.gz
go-c65a2781be7a8029435ea3d6a3c54c601ac4ba3e.zip
cmd/compile: better handling of incorrect type switches
Don't report errors if we don't have a correct type switch guard; instead ignore it and leave it to the type-checker to report the error. This leads to better error messages concentrating on the type switch guard rather than errors around (confusing) syntactic details. Also clean up some code setting up AssertExpr (they never have a nil Type field) and remove some incorrect TODOs. Fixes #24470. Change-Id: I69512f36e0417e3b5ea9c8856768e04b19d654a8 Reviewed-on: https://go-review.googlesource.com/103615 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'test/syntax')
-rw-r--r--test/syntax/typesw.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/syntax/typesw.go b/test/syntax/typesw.go
index 8d89860d11..f9120e8851 100644
--- a/test/syntax/typesw.go
+++ b/test/syntax/typesw.go
@@ -7,7 +7,7 @@
package main
func main() {
- switch main() := interface{}(nil).(type) { // ERROR "invalid variable name"
+ switch main() := interface{}(nil).(type) { // ERROR "invalid variable name|used as value"
default:
}
}