cue-lang/cue

import cycle causes infinite loop

Closed this issue · 1 comments

Originally opened by @thomas-wk in cuelang/cue#1057

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

Original reply by @myitcv in cuelang/cue#1057 (comment)

Thanks - this is a dup of cuelang/cue#849