summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/lexer.nim2
-rw-r--r--nimpretty/tests/expected/simple.nim5
-rw-r--r--nimpretty/tests/simple.nim5
3 files changed, 11 insertions, 1 deletions
diff --git a/compiler/lexer.nim b/compiler/lexer.nim
index 9b1dc642d..c15ecddfc 100644
--- a/compiler/lexer.nim
+++ b/compiler/lexer.nim
@@ -1042,7 +1042,7 @@ proc scanComment(L: var Lexer, tok: var Token) =
   tok.iNumber = 0
   assert L.buf[pos+1] == '#'
   when defined(nimpretty):
-    tok.commentOffsetA = L.offsetBase + pos - 1
+    tok.commentOffsetA = L.offsetBase + pos
 
   if L.buf[pos+2] == '[':
     skipMultiLineComment(L, tok, pos+3, true)
diff --git a/nimpretty/tests/expected/simple.nim b/nimpretty/tests/expected/simple.nim
index 5126658ea..d13558621 100644
--- a/nimpretty/tests/expected/simple.nim
+++ b/nimpretty/tests/expected/simple.nim
@@ -11,3 +11,8 @@ proc a() =
 
   # comment 2
   discard
+
+# bug #15596
+discard ## comment 3
+
+discard # comment 4
diff --git a/nimpretty/tests/simple.nim b/nimpretty/tests/simple.nim
index 5126658ea..435bd6bd2 100644
--- a/nimpretty/tests/simple.nim
+++ b/nimpretty/tests/simple.nim
@@ -11,3 +11,8 @@ proc a() =
 
   # comment 2
   discard
+
+# bug #15596
+discard## comment 3
+
+discard # comment 4