OK, here's a weird bug. Once I enable both --threads:on and --gc:orc, all of my unit tests (which uses the unittest module) fail to compile, with gnarly looking C errors:
/Users/snej/.cache/nim/testCodec_d/@mtestCodec.nim.c:1144:112: error: incomplete definition of type 'struct tySequence__shvncLWJZ4vpydQXcCi7CA_Content'
...eq___q9b1rGCpRgO9aMrUqDNKr8xg(&formatterX60gensym15390402_, NimTV_->formatters__55U7g4zhjHV9bCI6emTgDiA.p->data[i_3]);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/Users/snej/.cache/nim/testCodec_d/@mtestCodec.nim.c:81:16: note: forward declaration of 'struct tySequence__shvncLWJZ4vpydQXcCi7CA_Content'
typedef struct tySequence__shvncLWJZ4vpydQXcCi7CA_Content tySequence__shvncLWJZ4vpydQXcCi7CA_Content;
This happens regardless of whether the test file in question uses any threading/async code. If I turn off either threads or ORC, all is well, except that the new code I'm writing definitely requires both of them.
I took a look at the generated C file and it's definitely trying to use a forward-referenced but undeclared type. Beyond that I have no idea; the code's pretty dang well obfuscated!
(Nim 1.2.2 on macOS 10.15.5. I'm using the Xcode 12 beta, but I don't believe the command-line tools are affected by that; clang --version still reports Apple clang version 11.0.3 (clang-1103.0.32.62).)
Well, it would be nice if you try on the latest devel compiler :)
And if it still doesn't work - try to minimize it and report, like e.g. I did in some cases - https://github.com/nim-lang/Nim/issues?q=is%3Aissue+is%3Aopen+arc+author%3AYardanico
Turns out it's pretty trivial to reproduce. I've filed https://github.com/nim-lang/Nim/issues/14865 .
$ cat test.nim
import unittest
test "foo":
check 3 + 4 == 7
$ nim c -r --threads:on --gc:orc test.nim
Hint: used config file '/Users/snej/.choosenim/toolchains/nim-#devel/config/nim.cfg' [Conf]
Hint: used config file '/Users/snej/.choosenim/toolchains/nim-#devel/config/config.nims' [Conf]
............................
/Users/snej/.choosenim/toolchains/nim-#devel/lib/pure/collections/setimpl.nim(43, 32) Hint: passing 'n[i].key' to a sink parameter introduces an implicit copy; if possible, rearrange your program's control flow to prevent it [Performance]
CC: test.nim
/Users/snej/.cache/nim/test_d/@mtest.nim.c:888:88: error: incomplete definition of type 'struct tySequence__shvncLWJZ4vpydQXcCi7CA_Content'
formatter__bVJh0BzzmxXcXxRmZHEkHg = &NimTV_->formatters__55U7g4zhjHV9bCI6emTgDiA.p->data[i];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
...
Running your example gives me nice working results:
[OK] foo
But I also have strange suggestion like you:
Hint: passing 'n[i].key' to a sink parameter introduces an implicit copy; if possible, rearrange your program's control flow to prevent it [Performance]
I'm using nim 1.2.4 via choosenim in windows wsl (o_O) with ubuntu 20.04