use arrow precedence in spec (#20166)
* test using arrow precedence in spec refs #8759 * add test for #8759
This commit is contained in:
parent
557d79e7a2
commit
801eb3cb56
2 changed files with 8 additions and 1 deletions
|
|
@ -973,7 +973,7 @@ proc getPrecedence*(tok: Token): int =
|
||||||
|
|
||||||
# arrow like?
|
# arrow like?
|
||||||
if tok.ident.s.len > 1 and tok.ident.s[^1] == '>' and
|
if tok.ident.s.len > 1 and tok.ident.s[^1] == '>' and
|
||||||
tok.ident.s[^2] in {'-', '~', '='}: return 1
|
tok.ident.s[^2] in {'-', '~', '='}: return 0
|
||||||
|
|
||||||
template considerAsgn(value: untyped) =
|
template considerAsgn(value: untyped) =
|
||||||
result = if tok.ident.s[^1] == '=': 1 else: value
|
result = if tok.ident.s[^1] == '=': 1 else: value
|
||||||
|
|
|
||||||
|
|
@ -54,3 +54,10 @@ let
|
||||||
const
|
const
|
||||||
test =
|
test =
|
||||||
proc(): int = 1
|
proc(): int = 1
|
||||||
|
|
||||||
|
# bug #8759
|
||||||
|
block:
|
||||||
|
template `=>`(a, b): untyped = (a, b)
|
||||||
|
template `+=`(a, b): untyped = a * b
|
||||||
|
|
||||||
|
doAssert ("abc" => 3 += 5) == ("abc", 15)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue