summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorJuan M Gómez <info@jmgomez.me>2023-09-09 09:34:20 +0100
committerGitHub <noreply@github.com>2023-09-09 10:34:20 +0200
commite6ca13ec857dc065ebf3297129cc1538d4698f87 (patch)
tree1558f221071299fae8082ba23d069719c0c9aead /tests
parent5f13e15e0a6f90c462a71cd30addc677f688c4dc (diff)
downloadNim-e6ca13ec857dc065ebf3297129cc1538d4698f87.tar.gz
Instantiates generics in the module that uses it (#22513)
Attempts to move the generic instantiation to the module that uses it.
This should decrease re-compilation times as the source module where the
generic lives doesnt need to be recompiled

---------

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/ic/tgenericinst.nim11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ic/tgenericinst.nim b/tests/ic/tgenericinst.nim
new file mode 100644
index 000000000..3346764f5
--- /dev/null
+++ b/tests/ic/tgenericinst.nim
@@ -0,0 +1,11 @@
+discard """
+  cmd: "nim cpp --incremental:on $file"
+"""
+
+{.emit:"""/*TYPESECTION*/
+#include <iostream>
+  struct Foo { };
+""".}
+
+type Foo {.importcpp.} = object
+echo $Foo() #Notice the generic is instantiate in the this module if not, it wouldnt find Foo
\ No newline at end of file