cuelang/cue

import cycle causes infinite loop

thomas-wk opened this issue · 2 comments

cue mod init example.com/cue/
a/a.cue:
package a
import "example.com/cue/a/b"

#S1: b.#S3
#S2: string

a/b/b.cue
package b
import "example.com/cue/a"

#S3: a.#S2

cue def a/a.cue

Loop is between loader.importPkg() and instance.Complete()

If you put a check in importStack you can detect the cycle, looks like there used to be some cycle detection (reusePackage) that is unused now.

Results in inf loop, expected error for import cycles
Both in cue 0.4.0 and cue 0.3.2

Thanks - this is a dup of #849

This issue has been migrated to cue-lang/cue#1057.

For more details about CUE's migration to a new home, please see cue-lang/cue#1078.