Changes which may break some users are marked below with: ⚠️
Evaluator
self
experiment
The self
experiment enables a new "self" predeclared identifier, which refers to the innermost surrounding struct or list, or the top level if none exist.
Once a module's language.version
targets v0.15.0
, this can be enabled via the file attribute @experiment(self)
. The introduction of a new predeclared identifier should be a fully backwards compatible change. The LSP also adds support for the self
experiment.
For more information, see the proposal on GitHub and the spec change patch.
Other changes
⚠️ With its proposal accepted, the keepvalidators
experiment is now stable, meaning that CUE_EXPERIMENT=keepvalidators
is always enabled.
With its proposal accepted, the structcmp
experiment is now stable with language.version
at v0.15.0
or later, meaning that the @experiment(structcmp)
attribute is unnecessary as it's always enabled.
The evaluator now shows all user errors created with the error
builtin when they can be related to a disjunction failure. Previously, the evaluator would try to only show user errors directly part of a disjunction error, but that caused too many omissions.
Fix a regression introduced in v0.12.0
where incomplete errors were not being handled consistently if they directly involved the top-level value.
cmd/cue
A new cue help experiments
command is introduced to document all available per-file and global experiments.
Fix a regression introduced in v0.9.0
where loading a qualified pattern like ./...:pkgname
no longer filtered files based on the package name given.
LSP
Support is added for standalone CUE files, meaning any CUE file which is not part of a package inside a module. For example, a CUE file without a package declaration, or a CUE file outside of any CUE module.
Encodings
The YAML library in the archived Go module gopkg.in/yaml.v3
has been replaced by go.yaml.in/yaml/v3
, an active fork now maintained by the YAML organization.
cue exp gengotypes
is improved to handle more edge cases with CUE package imports which could result in broken Go code.
Go API
cue/ast.StringLabelNeedsQuoting
determines whether a string label needs to be quoted when used in CUE syntax.
cue/ast.NewStringLabel
creates an ast.Label
as either an unquoted identifier or a quoted string, depending on whether the string label needs quoting.
⚠️ cue/build.Instance.Match
is removed, given that it was never set to any value at any point since it was added.
Full list of changes since v0.15.0-alpha.1
- cmd/cue/cmd: alias
cue help experiment
by @rogpeppe in 5432a20
- internal/encoding/gotypes: handle CUE import aliases and duplicates by @phoban01 in ba534b5
- all: run cuetxtar garbage collection by @rogpeppe in 3e1e769
- internal/cuetxtar: implement garbage collection by @rogpeppe in a3eb068
- cue/ast: rename NewLabel to NewStringLabel by @mvdan in 869b034
- cue/build: remove the Instance.Match field, which was never set by @mvdan in dc3731d
- cue/literal: use Form.tripleQuote when quoting a string by @mvdan in af175ed
- cue/ast: remove commented out bits of code by @mvdan in ed355b0
- internal/core/compile: properly quote labels in error message paths by @mvdan in 01181e9
- cue/testdata: add a test case for quoting paths in evaluator errors by @mvdan in 08d34f9
- cue/format: remove unnecessary IsDefOrHidden check by @mvdan in 0010744
- encoding: use ast.StringLabelNeedsQuoting by @mvdan in a73e4cd
- cue/ast: add StringLabelNeedsQuoting by @mvdan in 1f88e1a
- internal/cuetdtest: consider the first item in a Matrix to be default by @rogpeppe in 1bc296c
- cue/stats: use
ResolveDep
in arithmetic by @rogpeppe in 37ebf7e
- cue/testdata/basicrewrite: use consistent spelling for "diff/explanation" by @rogpeppe in 8332fd5
- internal/core/adt: "write" stats file even when it isn't changing by @rogpeppe in 1873f84
- lsp/cache: be robust for nil file content by @cuematthew in ec216cf
- cue/parser: use more robust logic for detecting the end of an interpolation by @rogpeppe in afdde34
- cue/parser: add test case for string interpolation edge case by @rogpeppe in 276bcce
- cue/scanner: document how interpolations work by @rogpeppe in 7e9543b
- update all dependencies by @mvdan in 5944fee
- lsp/definitions: add support for the self experiment by @cuematthew in d4f9bfb
- lsp/definitions: completions from dot should be zero width by @cuematthew in 5c15642
- lsp/cache: prevent files from being both standalone and module/package by @cuematthew in 9357acf
- cue/ast: tweak ParseImportPath to treat
:pkgname
as .:pkgname
by @mvdan in 0a41be8
- cmd/cue: add a test case for the recent
:pkgname
CLI argument regression by @mvdan in a880c06
- lsp/cache: add support for standalone files by @cuematthew in 632f9b7
- internal/lsp: refactoring by @cuematthew in ab67c05
- cue/load: respect package qualifiers when matching wildcard packages by @rogpeppe in a862f84
- cue/loader: add test for issue 4110 by @rogpeppe in 36bcb3e
- internal/core/adt: add Kind.AllKinds and Kind.Count methods by @rogpeppe in 313e0c1
- internal/export: cater for NodeLink by @rogpeppe in b2a7b29
- cue: add test for issue 4093 by @rogpeppe in 47dab36
- cmd/cue: simplify when printing imported CUE schemas by @mvdan in 16118b3
- encoding/xml/koala: use ast.NewLabel by @mvdan in 880df5b
- internal/encoding/yaml: use cue/ast.NewLabel by @mvdan in 43c8a39
- cue/ast: introduce NewLabel helper for regular fields by @mvdan in 8561bce
- cmd/cue: remove debug print in
get go
by @mvdan in 91d2572
- internal/core/convert: use reflect.Value iterator methods by @mvdan in be9298b
- internal/core/adt: improve structure sharing for _ by @mpvl in 458b038
- internal/ci: update various action dependencies by @mvdan in 79e9f72
- swap gopkg.in/yaml.v3 for go.yaml.in/yaml/v3 by @mvdan in 2502321
- cue/load: add test case for the fixed issue 741 by @mvdan in b74aa03
- all: consistently split test table structs by @mvdan in 43fd8bc
- internal/core/adt: make Vertex.Elems return an iterator by @mvdan in e95b0f9
- cue: deduplicate work from adt.Vertex.Elems by @mvdan in 258881a
- all: swap len([]rune(s)) for utf8.RuneCountInString(s) by @mvdan in 2de87fb
- cmd/cue: remove the last use of
sh
in testscripts by @mvdan in 25d062b
- doc/ref/spec.md: some formatting and typo fixes by @mpvl in 139b17a
- doc/ref/spec.md: support unary == bound by @mpvl in 3500cef
- doc/ref/spec.md: support comparing values of different types by @mpvl in c356290
- internal/cueexperiment: make keepvalidators stable by @mpvl in c9da2b2
- cmd/cue: include global experiments in experiment help by @mpvl in 062fc5b
- internal/cueexperiment: standardize experiment lifecycle system by @mpvl in 9867177
- cmd/cue: added cue help experiments command by @mpvl in f1feade
- internal/core/adt: accept structcmp experiment by @mpvl in 8572198
- cue: implement "self" by @mpvl in 28641c0
- cmd/cue: test the handling of interrupt signals by @mvdan in 8e34149
- cmd/cue: treat top-level incomplete errors consistently by @mpvl in 26efa72
- cmd/cue: add test for issue 4079 and 4029 by @mpvl in 07635e5
- cue/testdata: add fixed test case for issue 3743 by @mvdan in bae3189
- cmd/cue: add test for issue 4005 by @mpvl in 1fc8f9d
- internal/core/adt: show all user errors by @mpvl in 519b41f
- internal/core/adt: add test for Issues 3983 and 3984 by @mpvl in ada7c5a
- internal/core/debug: prevent stack overflow by @mpvl in 59ed403
- internal/core/debug: remove use of compact printer type by @mpvl in 9ad4116