]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: use a map to detect duplicate type switch cases
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 1 Jun 2016 18:34:28 +0000 (11:34 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Tue, 23 Aug 2016 05:17:05 +0000 (05:17 +0000)
commitbd2838be77caf367cd6aede50c48279ee6b3a6c4
tree6dc945fcacd7cce20be506bfc83b3dc029cbe2fc
parent1a3006b03564936326e591f191a5af0630afca85
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>
src/cmd/compile/internal/gc/swt.go
test/switch5.go