summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/layouter.nim3
-rw-r--r--nimpretty/tests/exhaustive.nim6
-rw-r--r--nimpretty/tests/expected/exhaustive.nim6
3 files changed, 14 insertions, 1 deletions
diff --git a/compiler/layouter.nim b/compiler/layouter.nim
index 7b91b7bc4..6cb129fc1 100644
--- a/compiler/layouter.nim
+++ b/compiler/layouter.nim
@@ -247,7 +247,8 @@ proc emitTok*(em: var Emitter; L: TLexer; tok: TToken) =
     wr(TokTypeToStr[tok.tokType])
     if not em.inquote: wr(" ")
   of tkOpr, tkDotDot:
-    if (tok.strongSpaceA == 0 and tok.strongSpaceB == 0) or em.inquote:
+    if ((tok.strongSpaceA == 0 and tok.strongSpaceB == 0) or em.inquote) and
+      tok.ident.s notin ["<", ">", "<=", ">=", "==", "!="]:
       # bug #9504: remember to not spacify a keyword:
       lastTokWasTerse = true
       # if not surrounded by whitespace, don't produce any whitespace either:
diff --git a/nimpretty/tests/exhaustive.nim b/nimpretty/tests/exhaustive.nim
index 9a0f9a49b..2903a59af 100644
--- a/nimpretty/tests/exhaustive.nim
+++ b/nimpretty/tests/exhaustive.nim
@@ -360,3 +360,9 @@ foobar
 
 # bug #9673
 discard `* `(1, 2)
+
+proc fun4() =
+  var a = "asdf"
+  var i = 0
+  while i<a.len and i<a.len:
+    return
diff --git a/nimpretty/tests/expected/exhaustive.nim b/nimpretty/tests/expected/exhaustive.nim
index 8ea7ca4dd..cd3d136e7 100644
--- a/nimpretty/tests/expected/exhaustive.nim
+++ b/nimpretty/tests/expected/exhaustive.nim
@@ -369,3 +369,9 @@ foobar
 
 # bug #9673
 discard `*`(1, 2)
+
+proc fun4() =
+  var a = "asdf"
+  var i = 0
+  while i < a.len and i < a.len:
+    return