Skip to content

Commit

Permalink
fix off by 1 error in col shown by toFileLineCol (nim-lang#10138)
Browse files Browse the repository at this point in the history
* fix off by 1 error in `col` shown by toFileLineCol
* fix test failures
  • Loading branch information
timotheecour authored and Araq committed Dec 31, 2018
1 parent 7ac1fc8 commit ab72d68
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion compiler/msgs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ proc toFileLine*(conf: ConfigRef; info: TLineInfo): string {.inline.} =
result = toFilename(conf, info) & ":" & $info.line

proc toFileLineCol*(conf: ConfigRef; info: TLineInfo): string {.inline.} =
result = toFilename(conf, info) & "(" & $info.line & ", " & $info.col & ")"
result = toFilename(conf, info) & "(" & $info.line & ", " & $(info.col+1) & ")"

proc `$`*(conf: ConfigRef; info: TLineInfo): string = toFileLineCol(conf, info)

Expand Down
2 changes: 1 addition & 1 deletion tests/discard/tneedsdiscard.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
discard """
errormsg: '''expression 'open(f, "arg.txt", fmRead, -1)' is of type 'bool' and has to be discarded; start of expression here: tneedsdiscard.nim(7, 2)'''
errormsg: '''expression 'open(f, "arg.txt", fmRead, -1)' is of type 'bool' and has to be discarded; start of expression here: tneedsdiscard.nim(7, 3)'''
line: 10
"""

Expand Down
2 changes: 1 addition & 1 deletion tests/method/tmapper.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
discard """
errormsg: "invalid declaration order; cannot attach 'step' to method defined here: tmapper.nim(22, 7)"
errormsg: "invalid declaration order; cannot attach 'step' to method defined here: tmapper.nim(22, 8)"
line: 25
"""

Expand Down
2 changes: 1 addition & 1 deletion tests/modules/tmismatchedvisibility.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
discard """
errormsg: "public implementation 'tmismatchedvisibility.foo(a: int)[declared in tmismatchedvisibility.nim(6, 5)]' has non-public forward declaration in "
errormsg: "public implementation 'tmismatchedvisibility.foo(a: int)[declared in tmismatchedvisibility.nim(6, 6)]' has non-public forward declaration in "
line: 8
"""

Expand Down

0 comments on commit ab72d68

Please sign in to comment.