From: Josh Bleecher Snyder Date: Sun, 10 Mar 2019 03:34:58 +0000 (-0800) Subject: cmd/compile: normalize more whitespace in rewrite rules X-Git-Tag: go1.13beta1~1109 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b4fbd291b3872706422d39fd1140b7b929c77622;p=gostls13.git cmd/compile: normalize more whitespace in rewrite rules If you write a rewrite rule: (something) && noteRule("X")-> (something) then rulegen will panic with an error message about commutativity. The real problem is the lack of a space between the ) and the ->. Normalize that bit of whitespace too. Change-Id: Idbd53687cd0398fe275ff2702667688cad05b4ca Reviewed-on: https://go-review.googlesource.com/c/go/+/166427 Run-TryBot: Josh Bleecher Snyder TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- diff --git a/src/cmd/compile/internal/ssa/gen/rulegen.go b/src/cmd/compile/internal/ssa/gen/rulegen.go index 730e768ed6..f3a54b6299 100644 --- a/src/cmd/compile/internal/ssa/gen/rulegen.go +++ b/src/cmd/compile/internal/ssa/gen/rulegen.go @@ -1019,5 +1019,6 @@ func normalizeWhitespace(x string) string { x = strings.Join(strings.Fields(x), " ") x = strings.Replace(x, "( ", "(", -1) x = strings.Replace(x, " )", ")", -1) + x = strings.Replace(x, ")->", ") ->", -1) return x }