-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/core/adt: error message improvements
- add position to cycle errors - stop resolving selectors for failed nodes Issue #602 Change-Id: I813abe8db9d63c1fdb0913370bb942b8657b5f8d Reviewed-on: https://cue-review.googlesource.com/c/cue/+/7885 Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
- Loading branch information
Showing
11 changed files
with
166 additions
and
22 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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
-- references.cue -- | ||
|
||
missingField: { | ||
a: {} | ||
r: a.b | ||
} | ||
|
||
missingFieldClosed: { | ||
#a: {} | ||
r: #a.b | ||
} | ||
|
||
missingFieldNested: { | ||
a: {} | ||
// Must refer to `b` in error | ||
r: a.b.c | ||
} | ||
|
||
missingFieldNestedClosed: { | ||
#a: {} | ||
// Must refer to `d` in error | ||
r: #a.d.c | ||
} | ||
|
||
missingFieldNestedInInterpolation: { | ||
a: {} | ||
// Must refer to `b` in error | ||
r1: "\(a.b.c)" | ||
// Must refer to `d` in error: in case only one error is shown for a | ||
// a location, ensure it doesn't alphabetically sort and pick `c` instead. | ||
r2: "\(a.d.c)" | ||
} | ||
-- out/eval -- | ||
Errors: | ||
missingFieldClosed.r: undefined field b: | ||
./references.cue:9:11 | ||
missingFieldNestedClosed.r: undefined field d: | ||
./references.cue:21:11 | ||
|
||
Result: | ||
(_|_){ | ||
// [eval] | ||
missingField: (struct){ | ||
a: (struct){ | ||
} | ||
r: (_|_){ | ||
// [incomplete] missingField.r: undefined field b: | ||
// ./references.cue:4:10 | ||
} | ||
} | ||
missingFieldClosed: (_|_){ | ||
// [eval] | ||
#a: (#struct){ | ||
} | ||
r: (_|_){ | ||
// [eval] missingFieldClosed.r: undefined field b: | ||
// ./references.cue:9:11 | ||
} | ||
} | ||
missingFieldNested: (struct){ | ||
a: (struct){ | ||
} | ||
r: (_|_){ | ||
// [incomplete] missingFieldNested.r: undefined field b: | ||
// ./references.cue:15:10 | ||
} | ||
} | ||
missingFieldNestedClosed: (_|_){ | ||
// [eval] | ||
#a: (#struct){ | ||
} | ||
r: (_|_){ | ||
// [eval] missingFieldNestedClosed.r: undefined field d: | ||
// ./references.cue:21:11 | ||
} | ||
} | ||
missingFieldNestedInInterpolation: (struct){ | ||
a: (struct){ | ||
} | ||
r1: (_|_){ | ||
// [incomplete] missingFieldNestedInInterpolation.r1: invalid interpolation: undefined field b: | ||
// ./references.cue:27:9 | ||
} | ||
r2: (_|_){ | ||
// [incomplete] missingFieldNestedInInterpolation.r2: invalid interpolation: undefined field d: | ||
// ./references.cue:30:9 | ||
} | ||
} | ||
} | ||
-- out/compile -- | ||
--- references.cue | ||
{ | ||
missingField: { | ||
a: {} | ||
r: 〈0;a〉.b | ||
} | ||
missingFieldClosed: { | ||
#a: {} | ||
r: 〈0;#a〉.b | ||
} | ||
missingFieldNested: { | ||
a: {} | ||
r: 〈0;a〉.b.c | ||
} | ||
missingFieldNestedClosed: { | ||
#a: {} | ||
r: 〈0;#a〉.d.c | ||
} | ||
missingFieldNestedInInterpolation: { | ||
a: {} | ||
r1: "\(〈0;a〉.b.c)" | ||
r2: "\(〈0;a〉.d.c)" | ||
} | ||
} |
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
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