Skip to content

Commit

Permalink
Add another test for non grouped imports
Browse files Browse the repository at this point in the history
Fix mismatched braces
  • Loading branch information
ire4ever1190 committed Sep 22, 2024
1 parent 593f016 commit 5b7de3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions compiler/importer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ proc importModuleAs(c: PContext; n: PNode, realModule: PSym, importHidden: bool)
result = createModuleAliasImpl(realModule.name)
if importHidden:
result.options.incl optImportHidden
let moduleIdent = (if n.kind == nkInfix: n[^1] else: n)
c.unusedImports.add((result, moduleIdent.info)
let moduleIdent = if n.kind == nkInfix: n[^1] else: n
c.unusedImports.add((result, moduleIdent.info))
c.importModuleMap[result.id] = realModule.id
c.importModuleLookup.mgetOrPut(result.name.id, @[]).addUnique realModule.id

Expand Down
12 changes: 7 additions & 5 deletions tests/tools/tunused_imports.nim
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
discard """
cmd: '''nim c --hint:Processing:off $file'''
nimout: '''
tunused_imports.nim(11, 10) Warning: BEGIN [User]
tunused_imports.nim(38, 10) Warning: END [User]
tunused_imports.nim(36, 8) Warning: imported and not used: 'strutils' [UnusedImport]
tunused_imports.nim(37, 13) Warning: imported and not used: 'strtabs' [UnusedImport]
tunused_imports.nim(37, 22) Warning: imported and not used: 'cstrutils' [UnusedImport]
tunused_imports.nim(14, 10) Warning: BEGIN [User]
tunused_imports.nim(41, 10) Warning: END [User]
tunused_imports.nim(37, 8) Warning: imported and not used: 'strutils' [UnusedImport]
tunused_imports.nim(38, 13) Warning: imported and not used: 'strtabs' [UnusedImport]
tunused_imports.nim(38, 22) Warning: imported and not used: 'cstrutils' [UnusedImport]
tunused_imports.nim(39, 12) Warning: imported and not used: 'macrocache' [UnusedImport]
'''
action: "compile"
"""
Expand Down Expand Up @@ -35,5 +36,6 @@ bar()

import strutils
import std/[strtabs, cstrutils]
import std/macrocache

{.warning: "END".}

0 comments on commit 5b7de3b

Please sign in to comment.