Skip to content

Commit

Permalink
remove need for --experimental:"enableImportAll"
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Dec 10, 2020
1 parent 8414b46 commit 7bdd6e4
Show file tree
Hide file tree
Showing 14 changed files with 0 additions and 16 deletions.
2 changes: 0 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@
helps avoid using workarounds such as using `include` when you need a private symbol for
testing (which has known issues) or making some internal APIs public just because another internal
module needs those. It also helps mitigate the lack of cyclic imports in some cases.
Enable it with `{.experimental: "enableImportAll".}`, either
in command line or in a scope.


## Compiler changes
Expand Down
2 changes: 0 additions & 2 deletions compiler/importer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ proc transformImportAs(c: PContext; n: PNode): tuple[node: PNode, importFlags: I
if n2.len == 2 and n2[1].kind == nkPragma and n2[1].len == 1 and n2[1][0].kind == nkIdent and whichKeyword(n2[1][0].ident) == wImportAll: discard
else:
globalError(c.config, n.info, "invalid import pragma, expected: " & $wImportAll)
if enableImportAll notin c.features:
globalError(c.config, n.info, "requires --experimental:" & $enableImportAll)
ret.importFlags.incl ifImportAll
result = n2[0]
else:
Expand Down
1 change: 0 additions & 1 deletion compiler/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ type
vmopsDanger,
strictFuncs,
views,
enableImportAll, # for: `import foo {.all.}`

LegacyFeature* = enum
allowSemcheckedAstModification,
Expand Down
1 change: 0 additions & 1 deletion tests/importalls/m1.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{.experimental: "enableImportAll".}
import ./m2
import ./m3 {.all.} as m3
from ./m3 as m3Bis import nil
Expand Down
1 change: 0 additions & 1 deletion tests/importalls/m4.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{.warning[UnusedImport]: off.} # xxx bug: this shouldn't be needed since we have `export m3`
{.push experimental: "enableImportAll".}
import ./m3 {.all.}
export m3
# export m3 {.all.} # xxx this could be supported in future
Expand Down
1 change: 0 additions & 1 deletion tests/importalls/mt0.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{.push experimental: "enableImportAll".}
import ./m1 as m
doAssert compiles(foo0)
doAssert not compiles(foo1)
Expand Down
1 change: 0 additions & 1 deletion tests/importalls/mt1.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{.push experimental: "enableImportAll".}
import ./m1 {.all.} as m
doAssert foo1 == 2
doAssert m.foo1 == 2
Expand Down
1 change: 0 additions & 1 deletion tests/importalls/mt2.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{.push experimental: "enableImportAll".}
from ./m1 {.all.} as m import foo1
from ./m1 {.all.} as m2 import foo7
doAssert foo1 == 2
Expand Down
1 change: 0 additions & 1 deletion tests/importalls/mt3.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{.push experimental: "enableImportAll".}
import ./m1 {.all.}
doAssert foo1 == 2

Expand Down
1 change: 0 additions & 1 deletion tests/importalls/mt4.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{.push experimental: "enableImportAll".}
import ./m1 {.all.} except foo1
doAssert foo2 == 2
doAssert declared(foo2)
Expand Down
1 change: 0 additions & 1 deletion tests/importalls/mt4b.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{.push experimental: "enableImportAll".}
from ./m1 {.all.} as m2 import nil
doAssert not compiles(foo1)
doAssert m2.foo1 == 2
1 change: 0 additions & 1 deletion tests/importalls/mt5.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{.push experimental: "enableImportAll".}
import ./m1 {.all.} as m2 except foo1
doAssert foo2 == 2
doAssert not compiles(foo1)
Expand Down
1 change: 0 additions & 1 deletion tests/importalls/mt6.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{.push experimental: "enableImportAll".}
import ./m1 {.all.} as m2
doAssert compiles(foo1)
doAssert compiles(m2.foo1)
Expand Down
1 change: 0 additions & 1 deletion tests/importalls/mt8.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ test multiple imports
]#

{.warning[UnusedImport]: off.}
{.push experimental: "enableImportAll".}
import ./m1, m2 {.all.}, ./m3 {.all.}

# m1 is regularly imported
Expand Down

0 comments on commit 7bdd6e4

Please sign in to comment.