import foo {.all.} reboot (#17706)

This commit is contained in:
Timothee Cour 2021-04-16 00:16:39 -07:00 • committed by GitHub
commit 8161b02897
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 584 additions and 76 deletions

9
tests/ic/mimports.nim Normal file
View file

@ -0,0 +1,9 @@
from mimportsb {.all.} import fnb1, hfnb3
proc fn1*(): int = 1
proc fn2*(): int = 2
proc hfn3(): int = 3
proc hfn4(): int = 4
proc hfn5(): int = 5
export mimportsb.fnb2, hfnb3

4
tests/ic/mimportsb.nim Normal file
View file

@ -0,0 +1,4 @@
proc fnb1*(): int = 1
proc fnb2*(): int = 2
proc hfnb3(): int = 3
proc hfnb4(): int = 4

29
tests/ic/timports.nim Normal file
View file

@ -0,0 +1,29 @@
import mimports
doAssert fn1() == 1
doAssert not declared(hfn3)
#!EDIT!#
import mimports {.all.}
doAssert fn1() == 1
doAssert declared(hfn3)
doAssert hfn3() == 3
doAssert mimports.hfn4() == 4
# reexports
doAssert not declared(fnb1)
doAssert not declared(hfnb4)
doAssert fnb2() == 2
doAssert hfnb3() == 3
#!EDIT!#
from mimports {.all.} import hfn3
doAssert not declared(fn1)
from mimports {.all.} as bar import fn1
doAssert fn1() == 1
doAssert hfn3() == 3
doAssert not declared(hfn4)
doAssert declared(mimports.hfn4)
doAssert mimports.hfn4() == 4
doAssert bar.hfn4() == 4