1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builder: fix false-positive import cycle warning

This commit is contained in:
spaceface777 2020-05-19 13:17:03 +02:00 committed by GitHub
parent 96a8eaabc5
commit e07869af91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -95,9 +95,9 @@ pub fn (mut b Builder) parse_imports() {
pub fn (mut b Builder) resolve_deps() {
graph := b.import_graph()
deps_resolved := graph.resolve()
is_main_to_builtin := deps_resolved.nodes.len == 1 && deps_resolved.nodes[0].name == 'main' && deps_resolved.nodes[0].deps.len == 1 && deps_resolved.nodes[0].deps[0] == 'builtin'
if !deps_resolved.acyclic && !is_main_to_builtin {
eprintln('warning: import cycle detected between the following modules: \n' + deps_resolved.display_cycles())
cycles := deps_resolved.display_cycles()
if cycles.len > 1 {
eprintln('warning: import cycle detected between the following modules: \n' + cycles)
// TODO: error, when v itself does not have v.table -> v.ast -> v.table cycles anymore
return
}