diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-07-03 20:15:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-03 14:15:44 +0200 |
commit | c513e37a7052d44b789b6ec8ccfc94885193a7b5 (patch) | |
tree | 2011d6974c17f5b668bf29b037df9419ee8077ad | |
parent | d9a24b9b81e6a4e5f723951ec89990e35a9f7d44 (diff) | |
download | Nim-c513e37a7052d44b789b6ec8ccfc94885193a7b5.tar.gz |
fixes #22212; Compile error when running a Nimscript that compares se… (#22213)
fixes #22212; Compile error when running a Nimscript that compares seq with switch("mm", "arc")
-rw-r--r-- | compiler/commands.nim | 3 | ||||
-rw-r--r-- | compiler/scriptconfig.nim | 17 |
2 files changed, 16 insertions, 4 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim index 333a0f0d0..e12b047a6 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -527,10 +527,11 @@ proc registerArcOrc(pass: TCmdLinePass, conf: ConfigRef) = if conf.exc == excNone and conf.backend != backendCpp: conf.exc = excGoto -proc unregisterArcOrc(conf: ConfigRef) = +proc unregisterArcOrc*(conf: ConfigRef) = undefSymbol(conf.symbols, "gcdestructors") undefSymbol(conf.symbols, "gcarc") undefSymbol(conf.symbols, "gcorc") + undefSymbol(conf.symbols, "gcatomicarc") undefSymbol(conf.symbols, "nimSeqsV2") undefSymbol(conf.symbols, "nimV2") excl conf.globalOptions, optSeqDestructors diff --git a/compiler/scriptconfig.nim b/compiler/scriptconfig.nim index 21b0eb195..46751fe4e 100644 --- a/compiler/scriptconfig.nim +++ b/compiler/scriptconfig.nim @@ -17,7 +17,7 @@ import pathutils, pipelines when defined(nimPreviewSlimSystem): - import std/syncio + import std/[syncio, assertions] # we support 'cmpIgnoreStyle' natively for efficiency: from strutils import cmpIgnoreStyle, contains @@ -207,8 +207,8 @@ proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile; let oldGlobalOptions = conf.globalOptions let oldSelectedGC = conf.selectedGC - undefSymbol(conf.symbols, "nimv2") - conf.globalOptions.excl {optTinyRtti, optOwnedRefs, optSeqDestructors} + unregisterArcOrc(conf) + conf.globalOptions.excl optOwnedRefs conf.selectedGC = gcUnselected var m = graph.makeModule(scriptName) @@ -230,6 +230,17 @@ proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile; if conf.selectedGC in {gcArc, gcOrc, gcAtomicArc}: conf.globalOptions.incl {optTinyRtti, optSeqDestructors} defineSymbol(conf.symbols, "nimv2") + defineSymbol(conf.symbols, "gcdestructors") + defineSymbol(conf.symbols, "nimSeqsV2") + case conf.selectedGC + of gcArc: + defineSymbol(conf.symbols, "gcarc") + of gcOrc: + defineSymbol(conf.symbols, "gcorc") + of gcAtomicArc: + defineSymbol(conf.symbols, "gcatomicarc") + else: + doAssert false, "unreachable" # ensure we load 'system.nim' again for the real non-config stuff! resetSystemArtifacts(graph) |