mirror of
https://github.com/golang/go
synced 2024-11-15 01:50:28 -07:00
28fb8c6987
The compiler appears to contain several squirrelly corner cases where nodes are double walked, some where new nodes are created from walked parts. Rather than trust that we had searched hard enough for the last one, change exprSwitch.walk() to return immediately if it has already been walked. This appears to be the only case where double-walking a node is actually harmful. Fixes #29562. Change-Id: I0667e8769aba4c3236666cd836a934e256c0bfc5 Reviewed-on: https://go-review.googlesource.com/c/156317 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
27 lines
449 B
Go
27 lines
449 B
Go
// compile
|
|
|
|
// Copyright 2019 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.
|
|
|
|
// Triggers a double walk of the (inlined) switch in il
|
|
|
|
package p
|
|
|
|
func il(s string) string {
|
|
switch len(s) {
|
|
case 0:
|
|
return "zero"
|
|
case 1:
|
|
return "one"
|
|
}
|
|
return s
|
|
}
|
|
|
|
func f() {
|
|
var s string
|
|
var as []string
|
|
switch false && (s+"a"+as[0]+il(s)+as[0]+s == "") {
|
|
}
|
|
}
|