v0.3.0-beta.5
This release has some important bug fixes. It also is a bit stricter in considering some errors that were previously evaluation-time errors to be compile time errors.
There is also a slight change in default handling, which should not affect most configurations.
New compile-time errors
The expression >10 <20
is syntactically valid CUE, but can never meaningfully evaluate to something. It parses as >(10 < 20)
and thus evaluates to >true
, which is undefined. The error messages associated with this were often confusing to the user. Also, leaving this to be detected during runtime would sometimes hide the error away.
Consistent with the “fail early” mantra, these cases are now detected and reported by the compiler.
Backwards compatibility
Defaults
Previously, for
#def: {
*{} | {a: int} | {b: int}
*{} | {c: int} | {d: int}
}
x: #def & {a: int}
would officially resolve to
x: {a: int} | {a: int, c: int} | {a: int, d: int}
Thanks to a hack in the current v0.3 implementation, the first disjunct was made the default and all resolved fine. We have now slightly changed the definition of defaults to handle this case.
Basically, now if during a unification all terms of a disjunction that are marked as default are eliminated, the remaining terms will behave as if they originated from an unmarked disjunction.
In practice this means defaults behave as users typically expect them to behave. This may also cover cases that were not previously handed
Note that v0.2 solved things differently: if in the result of a disjunction one term subsumes another, then the latter could be dropped. So in v0.2, the answer would be x: {a: int}
, even in the absence of defaults. The problem with this approach is that it could lead to confusing answers and that the default could not always be accurately determined. A goal of v0.3 was to have a simpler story for disambiguation and let simplifications be merely a matter of optimization.
There is still a slight discrepancy in the current implementation and the spec that may cause unexpected results. We expect this to be sufficiently rare and we intend to address this in a rework of disjunction computation, aimed at further performance optimizations.
Changelog
1b03c9f ci: move to non-Docker version of goreleaser
ae51469 ci: skip known flakey test on go1.15 windows
500e431 doc/ref/spec.md: add missing binary_digits
89cada6 doc/tutorial: address cuelang/cuelang.org#126
77b475f doc: fix install instructions in main README and contributing
25ba1d9 internal/core/adt: comment out leak test
b25147c internal/core/adt: control fixes for if clauses
267379b internal/core/adt: fix trim bug
48d255a internal/core/adt: some optimizations for pattern constraints
87d43b7 internal/core/adt: strip "notDefault" status for disjunctions with unused defaults
760aa11 internal/core/compile: make >10 <20
a compile error
b20ac5a internal/core/convert: fix conversion from float
bcd752a internal/core/eval: handle embedded top correctly
a5daa16 internal/core/export: fix quoting of definitions
cb4fae9 internal/cuetest: consolidate testscript/cuetxtar helpers
bf6c3fc internal/cuetest: move Kubernetes related helper to where they are used
15934d9 tools/trim: add tracer
1d9aa17 tools/trim: don't trim shared nodes
af5ea97 tools/trim: fix defaults bug