github cue-lang/cue v0.14.0-alpha.1

latest releases: v0.14.1, v0.15.0-0.dev, v0.14.0...
pre-release2 months ago

This release introduces a new error builtin, two language changes, and many fixes and optimizations for the new closedness algorithm.

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

Evaluator

error builtin

A new error builtin is added to the language, which allows users to create custom error values with a specified message.

Don't simplify validators into concrete values

A new CUE_EXPERIMENT=keepvalidators experiment is introduced, already on by default, which prevents validators from being simplified into concrete values.

X == Y and == X

Firstly, there were several bug fixes related to ==. Most notably, [int] == [int] incorrectly resolved to true. It now correctly resolves to an error.

All other changes are enabled using the @experiment(structcmp) file-level attribute.
Enabling thix experiment allows all CUE values to be compared for equality. This includes comparing structs.

The same experiment also allows a unary == to enforce that a value is a specific concrete value.

Documentation and examples will be available for the v0.14.0 release.

Other changes

⚠️ The file embedding experiment can no longer be disabled via CUE_EXPERIMENT=embed=0, having been introduced in CUE v0.10.0.

File embedding is now enabled when using the cue/cuecontext or cue/load APIs; earlier versions could not expose it via the Go API due to an import cycle.

⚠️ The topological field sorting experiment can no longer be disabled via CUE_EXPERIMENT=toposort=0, having been introduced in CUE v0.11.0.

⚠️ CUE_EXPERIMENT=cmdreferencepkg, introduced in v0.13.0 to require referencing tool packages to declare cue cmd tasks, is now on by default.

The new closedness algorithm has been adjusted to fix a number of "field not allowed" bugs, particularly in the form of regressions compared to the old evaluator.

A particularly slow part of the new closedness algorithm has been optimized, resulting in improvements of up to 10x in wall times for some projects.

cmd/cue

⚠️ cue def --strict jsonschema:, deprecated in favor of cue def jsonschema+strict: in v0.11.0, is no longer supported.

Go API

cue/load now provides module information via the new Instance.ModuleFile field.

⚠️ In order to support the above change, the mod/modfile.File.Format method has been moved to the function mod/modfile.Format: an API-breaking change but necessary to avoid a cyclic package dependency.

cue/parser gains a new Config API, which allows other packages like cue/load to properly apply the right parser options such as the CUE language version.

⚠️ In order to support the above change, the cue/parser.Config.ParseFile and cue/build.ParseFile signatures have now changed (incompatibly) to add a parser.Config argument, enabling the CUE language version to be passed through.

Fix an issue where cue.Value.Decode did not work with *math/big.Float types.

Full list of changes since v0.13.0
  • all: simplify three iterator uses with range-over-func by @mvdan in bb2494b
  • internal/core/adt: remove cycle check by @mpvl in d92e916
  • internal/core/adt: add tests for 3978 by @mpvl in 81795ac
  • internal/core/adt: revert 1217228 by @mpvl in 47912fc
  • cmd/cue/cmd: fix versiontest test by @rogpeppe in 2bbc359
  • doc/ref/spec.md: support struct and list for equality by @mpvl in d58d1f5
  • internal/core/compile: add version check for builtins by @mpvl in 985e693
  • internal/core/adt: add builtin for user-defined errors by @mpvl in 3ad8663
  • internal/core/adt: rename CallContext.Expr by @mpvl in 64ffd0d
  • doc/ref/spec.md: document error builtin by @mpvl in be18b05
  • internal/ci: update Go and goreleaser versions by @mvdan in 8d463da
  • update golang.org/x/... dependencies by @mvdan in e88d161
  • internal/core/adt: support unary == and != for all types by @mpvl in 030658e
  • internal/core/adt: comparison of values of different types by @mpvl in 34faddf
  • internal/core/adt: consider required fields for final values in Equal by @mpvl in 64d5789
  • internal/core/adt: support comparsion of structs by @mpvl in 2b7dfbd
  • internal/core/adt: fix error gobbling of internal nodes by @mpvl in 665f697
  • internal/core/adt: add tests for Issue 3977 by @mpvl in 996e8b0
  • cue/load: pass language version down to parser by @rogpeppe in d567750
  • cue/load: use error registry in SkipImports mode by @rogpeppe in 5a04616
  • cue/parser: enable cueexperiment.File throughout by @mpvl in 86f7a64
  • internal/cueexperiment: support for per-file experiments by @mpvl in 52988e0
  • internal/core/adt: simplify recursive getReqSets calls by @mvdan in 2d4263e
  • cmd/cue: remove CUE_SYNTAX_OVERRIDE support by @rogpeppe in 450ba7f
  • internal/core/adt: do not repeat replaceIDs calls by @mvdan in 8241d9c
  • cue/load: actually populate build.Instance.ModuleFile correctly by @rogpeppe in 48ec278
  • internal/core/adt: handle incomplete values in comparators by @mpvl in c925040
  • internal/core/adt: use replaceIDs incrementally in checkTypos by @mvdan in 16c782a
  • internal/core/adt: rewrite replaceIDs to scale better by @mvdan in b4212a3
  • internal/core/adt: Equal should take defaults when appropriate by @mpvl in 361384c
  • internal/core/adt: limit closedness check in Equal by @mpvl in e8e8682
  • internal/core/adt: merge validate package with adt by @mpvl in 26e1596
  • internal/core/adt: add tests for incomplete lists comparison by @mpvl in e67898f
  • cue/parser: add Config type by @rogpeppe in 211309c
  • cue/load: include module file in build.Instance by @rogpeppe in ab9ac54
  • internal/core/adt: use pointers for snapshot and result in nodeContext by @mvdan in 1a2d2e7
  • internal/core/adt: add tests for Issue 3929 by @mpvl in 7777230
  • internal/core/adt: handle yields in Resolve by @mpvl in 81e88ee
  • internal/core/adt: add tests for Issue 3972 by @mpvl in 0ac3913
  • internal/core/adt: make small iota enums consistently uint8 by @mvdan in ce44cfb
  • internal/core/adt: allow lookup across disjunction boundary by @mpvl in 20afefd
  • internal/core/adt: apply vertex rewriting to blocked tasks by @mpvl in d713052
  • internal/core/adt: add tests for 3967 by @mpvl in 5c5f970
  • cuecontext: revert support for CUE_EXPERIMENT by @mpvl in 2a70935
  • internal/pkg: only use %s with stringifiable builtin errors by @mvdan in fc4ca40
  • cue/parser: prohibit definition identifiers for package names by @rogpeppe in 548c23c
  • internal/core/export: avoid panic on non-regular identifiers for packages by @rogpeppe in 8bbf9b4
  • cmd/cue: add test cases for issue 3968 by @rogpeppe in e0010dd
  • cmd/cue: add testscript for exp gengotypes output filenames by @mvdan in b20d1a4
  • all: swap math/rand for math/rand/v2 where it affects behavior by @mvdan in 82ff070
  • all: remove a bit of dead code by @mvdan in ab546cf
  • cmd/cue: properly document the keepvalidators experiment by @mvdan in 398cdac
  • all: swap math/rand for math/rand/v2 where it doesn't affect behavior by @mvdan in db84c62
  • cmd/cue: fix error on cue mod rename with a bad module by @rogpeppe in 9f9ebac
  • cmd/cue: add test case for modrename with a bad module by @rogpeppe in 90d9b04
  • internal/core/adt: also create embed scope for disjunctions by @mpvl in c925902
  • internal/core/adt: add tests for 3964 by @mpvl in 2597e9e
  • internal/core/adt: fix default logic by @mpvl in 8dc494c
  • cueexperiment: export Config type and use it by @mpvl in 33a1792
  • internal/core/adt: add tests for 3958 by @mpvl in 5d162df
  • README: minor updates by @jpluscplusm in eb54082
  • internal/core: start removing pre-toposort field ordering code by @mvdan in 6fd9f7d
  • internal/core/adt: don't check removed scopes by @mpvl in 86ef530
  • internal/core/adt: track scope of closed() by @mpvl in c6abd6e
  • internal/core/adt: do not remove embed groups by @mpvl in 191a0eb
  • internal/core/adt: adjustments to closedness algo by @mpvl in 6746a82
  • internal/core/adt: change ellipsis to fix hidden bug by @mpvl in e9a4d11
  • internal/core/adt: update tests for 3833 and 3839 before fix by @mpvl in f7e46e9
  • internal/core/adt: add tests for Issue 3920 by @mpvl in 75660e3
  • internal/core/adt: also typo check disjuncts by @mpvl in dba18d3
  • internal/core/adt: add tests for Issue 3957 by @mpvl in deed94c
  • internal/core/adt: remove most validator simplifications by @mpvl in 487e526
  • internal/core/adt: copy bounds.txtar by @mpvl in 97927bc
  • cmd/cue: allow "access denied" testscript to pass on Wine by @mvdan in 250524b
  • cmd/cue: tweak two more testscripts to be portable by @mvdan in 9758314
  • cue/ast: improve ImportPath.Canonical by @rogpeppe in 12f3193
  • cue/ast: add more tests for ImportPath.Canonical by @rogpeppe in 3444f26
  • cue: fix decoding into big.Float by @haoqixu in dcc3088
  • cmd/cue: add false, echo, and cat testscript commands by @mvdan in d1210a5
  • cmd/cue: drop debug lines from testscripts by @mvdan in c0c6072
  • cue: add tests for issue 3927 by @haoqixu in 7cfda37
  • cue: use multiple sizes in BenchmarkLargeValueMarshalJSON by @mvdan in 4e0e427
  • update all other dependencies by @mvdan in b226e16
  • update golang.org/x/... by @mvdan in c947a0b
  • all: rely on iterators being available since Go 1.23 by @mvdan in 100a7cc
  • internal/golangorgx: remove files build-tagged for old Go versions by @mvdan in 15536aa
  • internal/golangorgx/tools/analysisinternal: remove by @mvdan in 830ad6f
  • cue/cuecontext: always enable embedding by @rogpeppe in e2e0711
  • internal/golangorgx/tools/typesinternal: remove by @mvdan in 6024ad4
  • internal/golangorgx/gopls/cache/methodsets: remove by @mvdan in 881004d
  • internal/golangorgx/tools/tokeninternal: remove by @mvdan in 518f13e
  • cue/load: make NoFilesError use position arguments for paths by @mvdan in 5b6d50f
  • cmd/cue: remove dev.txtar testscript by @mvdan in d0cb1dd
  • cmd/cue: deprecate --strict flag in favor of the jsonschema filetype tag by @mvdan in 00d3a8f
  • internal/cueexperiment: enable cmdreferencepkg by default by @mvdan in 16444fa
  • cmd/cue: turn all "cmd" testscripts away from legacy id/kind fields by @mvdan in 8b11b9d
  • internal/cueexperiment: toposort is always on now by @mvdan in 06de121
  • internal/cueexperiment: keep record of how experiments advanced by @mvdan in fa77cff
  • internal/cueexperiment: file embedding is always on now by @mvdan in 23f2527
  • all: ensure we init cuedebug and cueexperiment before every use by @mvdan in fc8460b
  • cmd/cue: consistently use the same top-level command context by @mvdan in 60e5703
  • cmd/cue: add more CUE_DEBUG=http tests by @mvdan in 6119be2
  • internal/core/adt: partially revert CL 1214950 by @mpvl in e1fd269
  • internal/core/adt: add tests for 3946 by @mpvl in d2adadc
  • internal/cueversion: avoid dependency on golang.org/x/mod by @rogpeppe in 94630d5
  • internal/core/adt: do not always filter disjuncts by @mpvl in 50e6b31
  • internal/core/adt: add tests for 3947 by @mpvl in a1f0964
  • cmd/cue: remove stale testscript txtar files for CUE_EXPERIMENT=modules=0 by @mvdan in b7b7cc7
  • internal/cueexperiment: tweak the docs for all experiment flags by @mvdan in 1981718
  • cmd/cue: consistently use tab indentation in help texts by @mvdan in 9113b8e
  • cmd/cue: drop evalv3=0 testscripts by @mvdan in a27b03f
  • cmd/cue: implement mirror --dry-run by @rogpeppe in 707f96b
  • internal/cueversion: bump languageVersion for v0.14 by @mvdan in 9eb4c14
  • internal/mod/modfiledata: factor out of mod/modfile by @rogpeppe in da6a638

Don't miss a new cue release

NewReleases is sending notifications on new releases.