Lineinfo fix (#10871)
This commit is contained in:
parent
514674cb38
commit
3794338aba
3 changed files with 20 additions and 1 deletions
|
|
@ -20,6 +20,7 @@ proc hasNoInit(call: PNode): bool {.inline.} =
|
||||||
|
|
||||||
proc fixupCall(p: BProc, le, ri: PNode, d: var TLoc,
|
proc fixupCall(p: BProc, le, ri: PNode, d: var TLoc,
|
||||||
callee, params: Rope) =
|
callee, params: Rope) =
|
||||||
|
genLineDir(p, ri)
|
||||||
var pl = callee & ~"(" & params
|
var pl = callee & ~"(" & params
|
||||||
# getUniqueType() is too expensive here:
|
# getUniqueType() is too expensive here:
|
||||||
var typ = skipTypes(ri.sons[0].typ, abstractInst)
|
var typ = skipTypes(ri.sons[0].typ, abstractInst)
|
||||||
|
|
|
||||||
|
|
@ -2453,7 +2453,7 @@ proc expr(p: BProc, n: PNode, d: var TLoc) =
|
||||||
putIntoDest(p, d, n, genLiteral(p, n))
|
putIntoDest(p, d, n, genLiteral(p, n))
|
||||||
of nkCall, nkHiddenCallConv, nkInfix, nkPrefix, nkPostfix, nkCommand,
|
of nkCall, nkHiddenCallConv, nkInfix, nkPrefix, nkPostfix, nkCommand,
|
||||||
nkCallStrLit:
|
nkCallStrLit:
|
||||||
genLineDir(p, n)
|
genLineDir(p, n) # may be redundant, it is generated in fixupCall as well
|
||||||
let op = n.sons[0]
|
let op = n.sons[0]
|
||||||
if n.typ.isNil:
|
if n.typ.isNil:
|
||||||
# discard the value:
|
# discard the value:
|
||||||
|
|
|
||||||
18
tests/errmsgs/tcall_with_default_arg.nim
Normal file
18
tests/errmsgs/tcall_with_default_arg.nim
Normal file
|
|
@ -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")
|
||||||
Loading…
Add table
Add a link
Reference in a new issue