diff --git a/compiler/lexer.nim b/compiler/lexer.nim index f2c94e06a2..06a6cea675 100644 --- a/compiler/lexer.nim +++ b/compiler/lexer.nim @@ -973,7 +973,7 @@ proc getPrecedence*(tok: Token): int = # arrow like? 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) = result = if tok.ident.s[^1] == '=': 1 else: value diff --git a/tests/parser/tprecedence.nim b/tests/parser/tprecedence.nim index 66a2922dbd..9be79543b7 100644 --- a/tests/parser/tprecedence.nim +++ b/tests/parser/tprecedence.nim @@ -54,3 +54,10 @@ let const test = proc(): int = 1 + +# bug #8759 +block: + template `=>`(a, b): untyped = (a, b) + template `+=`(a, b): untyped = a * b + + doAssert ("abc" => 3 += 5) == ("abc", 15)