mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
Parser: Test for exact missing ':' location column
This ensures compiler points to the right place when claiming that ':' is missing.
This commit is contained in:
12
tests/parser/tinvcolonlocation1.nim
Normal file
12
tests/parser/tinvcolonlocation1.nim
Normal file
@@ -0,0 +1,12 @@
|
||||
discard """
|
||||
file: "tinvcolonlocation1.nim"
|
||||
line: 8
|
||||
column: 3
|
||||
errormsg: "':' expected"
|
||||
"""
|
||||
try #<- missing ':'
|
||||
echo "try"
|
||||
except:
|
||||
echo "except"
|
||||
finally:
|
||||
echo "finally"
|
||||
15
tests/parser/tinvcolonlocation2.nim
Normal file
15
tests/parser/tinvcolonlocation2.nim
Normal file
@@ -0,0 +1,15 @@
|
||||
discard """
|
||||
file: "tinvcolonlocation2.nim"
|
||||
line: 11
|
||||
column: 1
|
||||
errormsg: "':' expected"
|
||||
"""
|
||||
try:
|
||||
echo "try"
|
||||
except #<- missing ':'
|
||||
echo "except"
|
||||
finally:
|
||||
#<-- error will be here above, at the beginning of finally,
|
||||
# since compiler tries to consome echo and part of except
|
||||
# expression
|
||||
echo "finally"
|
||||
12
tests/parser/tinvcolonlocation3.nim
Normal file
12
tests/parser/tinvcolonlocation3.nim
Normal file
@@ -0,0 +1,12 @@
|
||||
discard """
|
||||
file: "tinvcolonlocation3.nim"
|
||||
line: 12
|
||||
column: 3
|
||||
errormsg: "':' expected"
|
||||
"""
|
||||
try:
|
||||
echo "try"
|
||||
except:
|
||||
echo "except"
|
||||
finally #<- missing ':'
|
||||
echo "finally"
|
||||
Reference in New Issue
Block a user