do not track 'raise Defect' in the .raises: [] clause anymore (#14298)
* do not track 'raise Defect' in the .raises: [] clause anymore * --panics:on maps 'raise Defect' to an unrecoverable fatal error * make tests green again * update the documentation too
This commit is contained in:
parent
517dd800f8
commit
03c146cd93
6 changed files with 74 additions and 8 deletions
|
|
@ -315,7 +315,10 @@ proc addEffect(a: PEffects, e, comesFrom: PNode) =
|
|||
# we only track the first node that can have the effect E in order
|
||||
# to safe space and time.
|
||||
if sameType(a.graph.excType(aa[i]), a.graph.excType(e)): return
|
||||
throws(a.exc, e, comesFrom)
|
||||
|
||||
if e.typ != nil:
|
||||
if optNimV1Emulation in a.config.globalOptions or not isDefectException(e.typ):
|
||||
throws(a.exc, e, comesFrom)
|
||||
|
||||
proc addTag(a: PEffects, e, comesFrom: PNode) =
|
||||
var aa = a.tags
|
||||
|
|
|
|||
|
|
@ -1672,6 +1672,17 @@ proc isException*(t: PType): bool =
|
|||
t = skipTypes(t[0], abstractPtrs)
|
||||
return false
|
||||
|
||||
proc isDefectException*(t: PType): bool =
|
||||
var t = t.skipTypes(abstractPtrs)
|
||||
while t.kind == tyObject:
|
||||
if t.sym != nil and t.sym.owner != nil and
|
||||
sfSystemModule in t.sym.owner.flags and
|
||||
t.sym.name.s == "Defect":
|
||||
return true
|
||||
if t[0] == nil: break
|
||||
t = skipTypes(t[0], abstractPtrs)
|
||||
return false
|
||||
|
||||
proc isSinkTypeForParam*(t: PType): bool =
|
||||
# a parameter like 'seq[owned T]' must not be used only once, but its
|
||||
# elements must, so we detect this case here:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue