Skip to content
This repository was archived by the owner on Jan 3, 2025. It is now read-only.
This repository was archived by the owner on Jan 3, 2025. It is now read-only.

Shows problems even though recursive import works #197

@bichanna

Description

@bichanna

Recursive import is now supported in Nim, but currently, it shows a bunch of problems (errors?) in the problems panel.
(Already checked that the code works.)

Code:

# Module A
type
  T1* = int  # Module A exports the type `T1`
import moduleB     # the compiler starts parsing B

proc main() =
  var i = p(3) # works because B has been parsed completely here

main()
# Module B
import moduleA  # A is not parsed here! Only the already known symbols
          # of A are imported.

proc p*(x: moduleA.T1): moduleA.T1 =
  # this works because the compiler has already
  # added T1 to A's interface symbol table
  result = x + 1

Problems thrown:

moduleA.nim
undeclared identifier: 'p'

candidates (edit distance, scope distance); see '--spellSuggest':
(1, 4): '$' [func declared in /usr/local/Cellar/nim/1.6.2/nim/lib/system/dollars.nim(25, 8)]
(1, 4): '$' [func declared in /usr/local/Cellar/nim/1.6.2/nim/lib/system/dollars.nim(25, 8)]
(1, 4): '$' [func declared in /usr/local/Cellar/nim/1.6.2/nim/lib/system/dollars.nim(25, 8)]
(1, 4): '$' [func declared in /usr/local/Cellar/nim/1.6.2/nim/lib/system/dollars.nim(30, 6)]
This might be caused by a recursive module dependency:
/some/path/moduleB.nim imports /some/path/moduleA.nim
/some/path/moduleA.nim imports /some/path/moduleB.nim

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions