From 557dcfd87d6801138702e087935ad3c7053d5e87 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Wed, 18 Nov 2020 14:28:52 -0800 Subject: fix #16033 nim js --gc:arc works and ignores --gc:arc (#16036) --- compiler/commands.nim | 5 ++++- tests/arc/t16033.nim | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/arc/t16033.nim diff --git a/compiler/commands.nim b/compiler/commands.nim index 7a94fb612..1ad5ec64c 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -499,7 +499,10 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo; of "project": processOnOffSwitchG(conf, {optWholeProject, optGenIndex}, arg, pass, info) of "gc": - if conf.backend == backendJs: + if conf.backend == backendJs or conf.command == "js": + # for: bug #16033 + # This might still be imperfect, in rarse corner cases + # (where command is reset in nimscript, maybe). return expectArg(conf, switch, arg, pass, info) if pass in {passCmd2, passPP}: diff --git a/tests/arc/t16033.nim b/tests/arc/t16033.nim new file mode 100644 index 000000000..59ed22e4d --- /dev/null +++ b/tests/arc/t16033.nim @@ -0,0 +1,10 @@ +discard """ + targets: "c js" + matrix: "--gc:arc" +""" + +# bug #16033 +when defined js: + doAssert not compileOption("gc", "arc") +else: + doAssert compileOption("gc", "arc") -- cgit 1.4.1-2-gfad0