This commit is contained in:
Andreas Rumpf 2018-05-05 14:17:31 +02:00
commit 805402b294
3 changed files with 16 additions and 4 deletions

View file

@ -744,8 +744,9 @@ proc primarySuffix(p: var TParser, r: PNode, baseIndent: int): PNode =
# progress guaranteed # progress guaranteed
somePar() somePar()
result = namedParams(p, result, nkCurlyExpr, tkCurlyRi) result = namedParams(p, result, nkCurlyExpr, tkCurlyRi)
of tkSymbol, tkAccent, tkIntLit..tkCharLit, tkNil, tkCast, tkAddr, tkType: of tkSymbol, tkAccent, tkIntLit..tkCharLit, tkNil, tkCast, tkAddr, tkType,
if p.inPragma == 0: tkOpr, tkDotDot:
if p.inPragma == 0 and (isUnary(p) or p.tok.tokType notin {tkOpr, tkDotDot}):
# actually parsing {.push hints:off.} as {.push(hints:off).} is a sweet # actually parsing {.push hints:off.} as {.push(hints:off).} is a sweet
# solution, but pragmas.nim can't handle that # solution, but pragmas.nim can't handle that
let a = result let a = result

View file

@ -2,7 +2,10 @@ discard """
output: '''140 output: '''140
5-120-120 5-120-120
359 359
77''' 77
-4
-1
-1'''
""" """
#import math #import math
import sequtils import sequtils
@ -25,3 +28,11 @@ let a = [2,4,8].map do (d:int) -> int: d + 1
echo a[0], a[1], a[2] echo a[0], a[1], a[2]
echo(foo 8, foo 8) echo(foo 8, foo 8)
# bug #7582
proc f(x: int): int = x
echo f -4
echo int -1 # doesn't compile
echo int `-` 1 # compiles

View file

@ -1,5 +1,5 @@
discard """ discard """
errormsg: '''identifier expected, but found 'echo 4''' errormsg: '''in expression '4 2': identifier expected, but found '4'''
line: 6 line: 6
""" """