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>
This commit is contained in:
Juan M Gómez
2023-09-09 09:34:20 +01:00
committed by GitHub
parent 5f13e15e0a
commit e6ca13ec85
13 changed files with 52 additions and 8 deletions

11
tests/ic/tgenericinst.nim Normal file
View File

@@ -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