diff --git a/src/phrenderer.nim b/src/phrenderer.nim index 896a4f8..9304443 100644 --- a/src/phrenderer.nim +++ b/src/phrenderer.nim @@ -1704,8 +1704,6 @@ proc gsub(g: var TOutput, n: PNode, flags: SubFlags, extra: int) = gsub(g, n[0], flags = flags) # binary operator - doAssert n.len == 3 - # `fitsNL` governs a preference to fit an argument fully on a new line over # leaving parts of it on the same line as the operator. # This increases the probability that the line will end with an operator and diff --git a/tests/after/postexprs.nim b/tests/after/postexprs.nim index 05be10a..0ab0b2c 100644 --- a/tests/after/postexprs.nim +++ b/tests/after/postexprs.nim @@ -95,3 +95,9 @@ else: discard ( aaa.bbb.exec do(res: int64): size = res).ccc() + +macro `->`(a, b, c: untyped) = + discard + +1 -> 2 do: + discard diff --git a/tests/after/postexprs.nim.nph.yaml b/tests/after/postexprs.nim.nph.yaml index 005e7d1..4e155b9 100644 --- a/tests/after/postexprs.nim.nph.yaml +++ b/tests/after/postexprs.nim.nph.yaml @@ -576,3 +576,45 @@ sons: ident: "res" - kind: "nkIdent" ident: "ccc" + - kind: "nkMacroDef" + sons: + - kind: "nkAccQuoted" + sons: + - kind: "nkIdent" + ident: "->" + - kind: "nkEmpty" + - kind: "nkEmpty" + - kind: "nkFormalParams" + sons: + - kind: "nkEmpty" + - kind: "nkIdentDefs" + sons: + - kind: "nkIdent" + ident: "a" + - kind: "nkIdent" + ident: "b" + - kind: "nkIdent" + ident: "c" + - kind: "nkIdent" + ident: "untyped" + - kind: "nkEmpty" + - kind: "nkEmpty" + - kind: "nkEmpty" + - kind: "nkStmtList" + sons: + - kind: "nkDiscardStmt" + sons: + - kind: "nkEmpty" + - kind: "nkInfix" + sons: + - kind: "nkIdent" + ident: "->" + - kind: "nkIntLit" + intVal: 1 + - kind: "nkIntLit" + intVal: 2 + - kind: "nkStmtList" + sons: + - kind: "nkDiscardStmt" + sons: + - kind: "nkEmpty" diff --git a/tests/before/postexprs.nim b/tests/before/postexprs.nim index 9bd72df..f02ee50 100644 --- a/tests/before/postexprs.nim +++ b/tests/before/postexprs.nim @@ -97,3 +97,8 @@ else: discard discard (aaa.bbb.exec do(res: int64): size = res).ccc() + +macro `->`(a, b, c: untyped) = discard + +1 -> 2: + discard diff --git a/tests/before/postexprs.nim.nph.yaml b/tests/before/postexprs.nim.nph.yaml index 005e7d1..4e155b9 100644 --- a/tests/before/postexprs.nim.nph.yaml +++ b/tests/before/postexprs.nim.nph.yaml @@ -576,3 +576,45 @@ sons: ident: "res" - kind: "nkIdent" ident: "ccc" + - kind: "nkMacroDef" + sons: + - kind: "nkAccQuoted" + sons: + - kind: "nkIdent" + ident: "->" + - kind: "nkEmpty" + - kind: "nkEmpty" + - kind: "nkFormalParams" + sons: + - kind: "nkEmpty" + - kind: "nkIdentDefs" + sons: + - kind: "nkIdent" + ident: "a" + - kind: "nkIdent" + ident: "b" + - kind: "nkIdent" + ident: "c" + - kind: "nkIdent" + ident: "untyped" + - kind: "nkEmpty" + - kind: "nkEmpty" + - kind: "nkEmpty" + - kind: "nkStmtList" + sons: + - kind: "nkDiscardStmt" + sons: + - kind: "nkEmpty" + - kind: "nkInfix" + sons: + - kind: "nkIdent" + ident: "->" + - kind: "nkIntLit" + intVal: 1 + - kind: "nkIntLit" + intVal: 2 + - kind: "nkStmtList" + sons: + - kind: "nkDiscardStmt" + sons: + - kind: "nkEmpty"