aboutsummaryrefslogtreecommitdiff
path: root/test/switch5.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2016-06-01 11:34:28 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2016-08-23 05:17:05 +0000
commitbd2838be77caf367cd6aede50c48279ee6b3a6c4 (patch)
tree6dc945fcacd7cce20be506bfc83b3dc029cbe2fc /test/switch5.go
parent1a3006b03564936326e591f191a5af0630afca85 (diff)
downloadgo-bd2838be77caf367cd6aede50c48279ee6b3a6c4.tar.gz
go-bd2838be77caf367cd6aede50c48279ee6b3a6c4.zip
cmd/compile: use a map to detect duplicate type switch cases
This is a bit simpler than playing sorting games, and it is clearer that it generates errors in the correct (source) order. It also allows us to simplify sorting. It also prevents quadratic error messages for (pathological) inputs with many duplicate type cases. While we’re here, refactoring deduping into separate functions. Negligible compilebench impact. Fixes #15912. Change-Id: I6cc19edd38875389a70ccbdbdf0d9b7d5ac5946f Reviewed-on: https://go-review.googlesource.com/26762 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'test/switch5.go')
-rw-r--r--test/switch5.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/switch5.go b/test/switch5.go
index 7da2c6641f..bb0f5e33ad 100644
--- a/test/switch5.go
+++ b/test/switch5.go
@@ -57,8 +57,8 @@ func f4(e interface{}) {
case int:
case int: // ERROR "duplicate case int in type switch"
case int64:
- case error: // ERROR "duplicate case error in type switch"
case error:
+ case error: // ERROR "duplicate case error in type switch"
case fmt.Stringer:
case fmt.Stringer: // ERROR "duplicate case fmt.Stringer in type switch"
case struct {