Skip to content

Commit 0acd636

Browse files
committed
fix: Improve error message returned by Subsume
Previously when Subsume determined that a field did not subsume a previous field, the error returned was: ``` field x not present in <value> ``` which is simply not true. Now a more useful error is returned in this scenario: ``` 31 | 33 does not subsume 32: ./schema.cue:2:25 ./schema.cue:7:25 ``` Resolves: #3861 Signed-off-by: Graham Dennis <[email protected]>
1 parent 1856281 commit 0acd636

File tree

3 files changed

+1404
-240
lines changed

3 files changed

+1404
-240
lines changed

Diff for: internal/core/subsume/subsume.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func (s *subsumer) getError() (err errors.Error) {
122122
if s.missing != 0 {
123123
s.errf("missing field %q", s.missing.SelectorString(c))
124124
} else if b, ok := unifyValue(c, s.gt, s.lt).(*adt.Bottom); !ok {
125-
s.errf("value not an instance")
125+
s.errf("%v does not subsume %v", s.gt, s.lt)
126126
} else {
127127
s.errs = errors.Append(s.errs, b.Err)
128128
}

0 commit comments

Comments
 (0)