From b4fbd291b3872706422d39fd1140b7b929c77622 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Sat, 9 Mar 2019 19:34:58 -0800 Subject: [PATCH] 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 --- src/cmd/compile/internal/ssa/gen/rulegen.go | 1 + 1 file changed, 1 insertion(+) 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 } -- 2.50.0