]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: better handling of incorrect type switches
authorRobert Griesemer <gri@golang.org>
Fri, 30 Mar 2018 01:22:23 +0000 (18:22 -0700)
committerRobert Griesemer <gri@golang.org>
Tue, 3 Apr 2018 05:34:20 +0000 (05:34 +0000)
commitc65a2781be7a8029435ea3d6a3c54c601ac4ba3e
treeb7017c568143e1aca93a23af43603da4209e9be8
parent071f0de4ec0d912b2908821466818ca2be04655c
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>
src/cmd/compile/internal/gc/noder.go
src/cmd/compile/internal/syntax/nodes.go
src/cmd/compile/internal/syntax/parser.go
src/cmd/compile/internal/syntax/printer.go
test/fixedbugs/issue24470.go [new file with mode: 0644]
test/syntax/typesw.go