* enable stricteffects * add gcsafe * fix tests * use func * fixes pegs tests * explicitly mark repr related procs with noSideEffect * add nimLegacyEffects * change URL * fixes docopt * add `raises: []` to repr * fixes weave * fixes nimyaml * fixes glob * fixes parsetoml * Apply suggestions from code review * Update testament/important_packages.nim * add legacy:laxEffects
This commit is contained in:
parent
0510a2be0d
commit
1e15f975b8
16 changed files with 38 additions and 39 deletions
|
|
@ -30,11 +30,6 @@ define:useStdoutAsStdmsg
|
|||
warning[ObservableStores]: off
|
||||
@end
|
||||
|
||||
@if nimHasEffectsOf:
|
||||
experimental:strictEffects
|
||||
warningAsError:Effect:on
|
||||
@end
|
||||
|
||||
@if nimHasWarningAsError:
|
||||
warningAsError:GcUnsafe2:on
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -228,6 +228,8 @@ type
|
|||
## Historically and especially in version 1.0.0 of the language
|
||||
## conversions to unsigned numbers were checked. In 1.0.4 they
|
||||
## are not anymore.
|
||||
laxEffects
|
||||
## Lax effects system prior to Nim 2.0.
|
||||
|
||||
SymbolFilesOption* = enum
|
||||
disabledSf, writeOnlySf, readOnlySf, v2Sf, stressTest
|
||||
|
|
|
|||
|
|
@ -495,7 +495,7 @@ proc isIndirectCall(tracked: PEffects; n: PNode): bool =
|
|||
if n.kind != nkSym:
|
||||
result = true
|
||||
elif n.sym.kind == skParam:
|
||||
if strictEffects in tracked.c.features:
|
||||
if laxEffects notin tracked.c.config.legacyFeatures:
|
||||
if tracked.owner == n.sym.owner and sfEffectsDelayed in n.sym.flags:
|
||||
result = false # it is not a harmful call
|
||||
else:
|
||||
|
|
@ -581,7 +581,7 @@ proc isOwnedProcVar(tracked: PEffects; n: PNode): bool =
|
|||
tracked.owner == n.sym.owner
|
||||
#if result and sfPolymorphic notin n.sym.flags:
|
||||
# echo tracked.config $ n.info, " different here!"
|
||||
if strictEffects in tracked.c.features:
|
||||
if laxEffects notin tracked.c.config.legacyFeatures:
|
||||
result = result and sfEffectsDelayed in n.sym.flags
|
||||
|
||||
proc isNoEffectList(n: PNode): bool {.inline.} =
|
||||
|
|
@ -598,7 +598,7 @@ proc trackOperandForIndirectCall(tracked: PEffects, n: PNode, formals: PType; ar
|
|||
# assume indirect calls are taken here:
|
||||
if op != nil and op.kind == tyProc and n.skipConv.kind != nkNilLit and
|
||||
not isTrival(caller) and
|
||||
((param != nil and sfEffectsDelayed in param.flags) or strictEffects notin tracked.c.features):
|
||||
((param != nil and sfEffectsDelayed in param.flags) or laxEffects in tracked.c.config.legacyFeatures):
|
||||
|
||||
internalAssert tracked.config, op.n[0].kind == nkEffectList
|
||||
var effectList = op.n[0]
|
||||
|
|
@ -844,7 +844,7 @@ proc trackCall(tracked: PEffects; n: PNode) =
|
|||
assumeTheWorst(tracked, n, op)
|
||||
gcsafeAndSideeffectCheck()
|
||||
else:
|
||||
if strictEffects in tracked.c.features and a.kind == nkSym and
|
||||
if laxEffects notin tracked.c.config.legacyFeatures and a.kind == nkSym and
|
||||
a.sym.kind in routineKinds:
|
||||
propagateEffects(tracked, n, a.sym)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue