* fixes #11225; generic sandwich problems; [backport:1.2] * progress * delegating these symbols must be done via 'bind'
This commit is contained in:
parent
083eeda085
commit
2f213db7ee
24 changed files with 132 additions and 21 deletions
6
tests/sandwich/generic_library.nim
Normal file
6
tests/sandwich/generic_library.nim
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
proc libraryFunc*[T](x: T) =
|
||||
mixin mixedIn, indirectlyMixedIn
|
||||
echo mixedIn()
|
||||
echo indirectlyMixedIn()
|
||||
|
||||
3
tests/sandwich/helper_module.nim
Normal file
3
tests/sandwich/helper_module.nim
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
proc indirectlyMixedIn*: int =
|
||||
200
|
||||
12
tests/sandwich/module_using_generic_library.nim
Normal file
12
tests/sandwich/module_using_generic_library.nim
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
import
|
||||
generic_library, helper_module
|
||||
|
||||
proc mixedIn: int = 100
|
||||
|
||||
proc makeUseOfLibrary*[T](x: T) =
|
||||
bind mixedIn, indirectlyMixedIn
|
||||
libraryFunc(x)
|
||||
|
||||
when isMainModule:
|
||||
makeUseOfLibrary "test"
|
||||
9
tests/sandwich/tmain.nim
Normal file
9
tests/sandwich/tmain.nim
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
discard """
|
||||
output: '''100
|
||||
200'''
|
||||
"""
|
||||
|
||||
import
|
||||
module_using_generic_library
|
||||
|
||||
makeUseOfLibrary "test"
|
||||
Loading…
Add table
Add a link
Reference in a new issue