-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cue/load: add package import cycle error
When two or more packages import each other resulting in a cycle, cue/load used to cause an infinite loop. Error instead, since we explicitly don't support import cycles, per https://cuelang.org/docs/references/spec/#import-declarations: It is illegal for a package to import itself, directly or indirectly Fixes #849 Closes #2469 as merged as of commit ce73397. Signed-off-by: Artem V. Navrotskiy <[email protected]> Change-Id: I1928717b3df3c5e6c48eb4fa30966f26079e19c6 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1167597 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Roger Peppe <[email protected]>
- Loading branch information
Showing
5 changed files
with
48 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
cue/load/testdata/testmod/cue.mod/pkg/mod.test/cycle/bar/bar.cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package bar | ||
|
||
import "mod.test/cycle/foo" | ||
|
||
#Bar1: foo.#Foo1 + 8 | ||
#Bar2: foo.#Foo2 + 16 |
7 changes: 7 additions & 0 deletions
7
cue/load/testdata/testmod/cue.mod/pkg/mod.test/cycle/foo/foo.cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package foo | ||
|
||
import "mod.test/cycle/bar" | ||
|
||
#Foo1: 1 | ||
#Foo2: bar.#Bar1 + 2 | ||
#Foo: bar.#Bar2 + 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package cycle | ||
|
||
import "mod.test/cycle/foo" | ||
|
||
Foo: foo.#Foo |