mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-24 08:15:25 +00:00
recursive modules are only detected to improve error messages
This commit is contained in:
@@ -2,6 +2,7 @@ discard """
|
||||
file: "mrecmod.nim"
|
||||
line: 1
|
||||
errormsg: "recursive module dependency detected"
|
||||
disabled: true
|
||||
"""
|
||||
# recursive module
|
||||
import mrecmod
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
discard """
|
||||
file: "mrecmod2.nim"
|
||||
line: 2
|
||||
errormsg: "recursive module dependency detected"
|
||||
output: "4"
|
||||
"""
|
||||
type
|
||||
T1* = int # Module A exports the type ``T1``
|
||||
|
||||
import mrecmod2 # the compiler starts parsing B
|
||||
|
||||
# the manual says this should work
|
||||
proc main() =
|
||||
var i = p(3) # works because B has been parsed completely here
|
||||
echo p(3) # works because B has been parsed completely here
|
||||
|
||||
main()
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
discard """
|
||||
file: "tselfimport.nim"
|
||||
line: 7
|
||||
errormsg: "recursive module dependency detected"
|
||||
errormsg: "A module cannot import itself"
|
||||
"""
|
||||
import strutils as su # guard against regression
|
||||
import tselfimport #ERROR
|
||||
|
||||
Reference in New Issue
Block a user