cuelang / cue

CUE has moved to https://github.com/cue-lang/cue
https://cuelang.org
Apache License 2.0
3.09k stars 171 forks source link

import cycle causes infinite loop #1057

Closed thomas-wk closed 3 years ago

thomas-wk commented 3 years ago

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

myitcv commented 3 years ago

Thanks - this is a dup of https://github.com/cuelang/cue/issues/849

cueckoo commented 3 years ago

This issue has been migrated to https://github.com/cue-lang/cue/issues/1057.

For more details about CUE's migration to a new home, please see https://github.com/cue-lang/cue/issues/1078.