github cue-lang/cue v0.18.0-rc.3

pre-release4 hours ago

Changes which may break some users are marked below with: ⚠️

Language

The spec now states that close returns a value which is not a struct or list unchanged, where it failed on a scalar. A disjunction passed to it keeps its scalar disjuncts, with each struct disjunct closed as before.

Evaluator

Fix several regressions introduced in earlier v0.18 pre-releases, involving defaults, comprehensions, and let declarations (#4526, #4530, #4532, #4533).

Fix several regressions introduced in v0.17.0: a vertex not initialized panic when flattening a pattern-constrained map selected from an inline struct (#4521), a disjunction's default not applied when a comprehension guard reads it before the disjunction is declared (#4520), and, at language versions before v0.18.0, spurious field not allowed errors on the elements of a list whose validator is embedded through a definition (#4522) and on the fields of definitions embedded at a package root through a regular field (#4523).

Two fixes align closedness with the spec: a field opened with the spread operator, as in s: #B..., is now closed again when it is also unified with #B itself, in either order (#4525), and a field which a spread adds within a definition is now closed when selected through a regular field holding the definition, which the spec now states explicitly (#4528).

As the spec requires, a comprehension at the top level of a struct passed to close now sees the fields unified into that struct from outside, where it failed as incomplete, which could break configurations after cue mod upgrade (#4535).

⚠️ As the spec requires, an ellipsis in an embedding, as in s: {{#B, ...}, h: {i: 1}}, now opens only the struct it is part of, and no longer the structs declared beside the embedding, so that a field added to one of them, such as s: h: extra: 1, is rejected as field not allowed, as it already was when the embedder was reached through a reference. Give such a struct its own ellipsis, as in h: {i: 1, ...}, or declare the field in it.

Configurations with many nested disjunctions, such as schemas imported from JSON Schema, evaluate up to 9% faster and allocate up to 16% less memory.

cmd/cue

cue fix and cue mod upgrade now leave fewer structs wrapped in __closeAll or __reclose (#4534), and no longer produce invalid syntax when converting an alias named by a keyword such as in. New names picked by the exporter are numbered sequentially, as in x_1.

A failed tool/exec.Run task which must succeed now includes the captured standard error in its error message.

Fix panics in cue trim when a comprehension clause after a for or let clause refers to an outer field (#4537), and in cue def -e when the selected value refers to a field whose label is not a valid identifier, such as "foo-bar".

Don't miss a new cue release

NewReleases is sending notifications on new releases.