diff options
author | Arne Döring <arne.doering@gmx.net> | 2019-03-21 06:54:42 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-03-21 06:54:42 +0100 |
commit | 3794338aba2a085bc72761307b8849fff07ed429 (patch) | |
tree | c64a05373dc3bb4e98ddf26411f92ae6c40f28ee | |
parent | 514674cb38e46b93d26f78e87244e1cfef67ccdb (diff) | |
download | Nim-3794338aba2a085bc72761307b8849fff07ed429.tar.gz |
Lineinfo fix (#10871)
-rw-r--r-- | compiler/ccgcalls.nim | 1 | ||||
-rw-r--r-- | compiler/ccgexprs.nim | 2 | ||||
-rw-r--r-- | tests/errmsgs/tcall_with_default_arg.nim | 18 |
3 files changed, 20 insertions, 1 deletions
diff --git a/compiler/ccgcalls.nim b/compiler/ccgcalls.nim index 4c8fa7147..cefa89289 100644 --- a/compiler/ccgcalls.nim +++ b/compiler/ccgcalls.nim @@ -20,6 +20,7 @@ proc hasNoInit(call: PNode): bool {.inline.} = proc fixupCall(p: BProc, le, ri: PNode, d: var TLoc, callee, params: Rope) = + genLineDir(p, ri) var pl = callee & ~"(" & params # getUniqueType() is too expensive here: var typ = skipTypes(ri.sons[0].typ, abstractInst) diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 7de5e5606..28aa875bc 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -2453,7 +2453,7 @@ proc expr(p: BProc, n: PNode, d: var TLoc) = putIntoDest(p, d, n, genLiteral(p, n)) of nkCall, nkHiddenCallConv, nkInfix, nkPrefix, nkPostfix, nkCommand, nkCallStrLit: - genLineDir(p, n) + genLineDir(p, n) # may be redundant, it is generated in fixupCall as well let op = n.sons[0] if n.typ.isNil: # discard the value: diff --git a/tests/errmsgs/tcall_with_default_arg.nim b/tests/errmsgs/tcall_with_default_arg.nim new file mode 100644 index 000000000..1cc86638f --- /dev/null +++ b/tests/errmsgs/tcall_with_default_arg.nim @@ -0,0 +1,18 @@ +discard """ +outputsub: '''tcall_with_default_arg.nim(16) anotherFoo''' +exitcode: 1 +""" +# issue: #5604 + +proc fail() = + raise newException(ValueError, "dead") + +proc getDefault(): int = 123 + +proc bar*(arg1: int = getDefault()) = + fail() + +proc anotherFoo(input: string) = + bar() + +anotherFoo("123") |