v0.18.0-rc.2
Changes which may break some users are marked below with a warning.
Warning
The cue-lang/tap Homebrew tap is retired. On macOS, install CUE Labs’ build with brew install cue-labs/tap/cue; see Installing CUE. For the open-source build, use Homebrew’s own formula, brew install cue. Existing installations from cue-lang/tap move to that formula on brew update; cue-lang/homebrew-tap has the details.
Language
A CUE file which belongs to no module can now declare the language version it is written for with a @version attribute, placed ahead of any other file attribute and the package clause, so that a reproducer or a standalone file written for an older version runs as written without creating a module for it. The attribute is an error in a file of a module which declares a language version, as the module file decides the version of its files. cue fix adds the attribute when it enables an experiment in such a file, recording the version the file was migrated at.
@version(v0.17.0)
package p
The functions experiment
Warning
The experiment now follows the revised proposal on function contracts: an implementation unified with a function type must accept every argument the type admits, callbacks are checked where they are passed, and two function literals with different bodies no longer compose when unified, undoing the change announced in v0.18.0-alpha.3. Some configurations which evaluated before are now rejected; the proposal lists them and how to fix them.
Evaluator
A reference unified with a definition or with a disjunction of definitions, as in deps: [...#Node] with #Node: #Task | #Group, is now shared with the value it refers to rather than evaluated again under every path, so that a dependency graph typed this way is evaluated once per node rather than exponentially in its depth, regardless of the order in which the fields are declared (#4512, #4513).
Exporting a struct holding many unifications of empty or single-field structs no longer takes memory exponential in their number.
The != and =~ bounds and the builtin validators of a field in an inline struct or a let which is read through a reference, such as by an interpolation, are now checked, where they were silently dropped. This surfaces conflicts which earlier releases accepted, such as a let inside a definition which sets an integer on a field declared as a float with a default (#4510).
cmd/cue
The new cue mod upgrade command moves a module to a new language version, rewriting every CUE file of the module for that version, including those under cue.mod, before recording the version in cue.mod/module.cue. Files are rewritten without loading them, so a package whose import cannot be resolved is converted all the same, and a file which cannot be converted stops the upgrade before anything is written unless --force is given. cue fix without package arguments now fixes every file of the module the same way, from any directory inside it, and the explicitopen rewrite fixes several cases where it closed a value which the original left open.
The new --language-version flag of the commands which read CUE outside a module, among them cue eval, cue export, cue vet, cue fmt, cue fix, cue import, and cue get go, selects the language version for files which belong to no module, including standard input. It is only a fallback: the files of a module which declares a language version keep that version, and a file’s own @version attribute takes precedence. CUE generated by cue import, cue get go, and cue get crd targets the chosen version.
cue cmd now reports the errors within a command which declares no tasks, such as a comprehension or dynamic field which failed to declare them, alongside no tasks found (#3536). Its memory use no longer grows with the number of tasks which return a result, as tools/flow now releases each earlier configuration once the tasks depending on it have completed: the peak memory of a command running 40 such tasks drops from about 500MB to about 125MB (#4509).
LSP server
The language server now understands the function literals of the functions experiment. References in a function’s body, parameter constraints, defaults, and result type resolve, so go-to-definition, find references, rename, and completion work inside a function literal, and a rename of a parameter covers every literal unified with the function. The label of a labeled argument resolves to the parameter it binds, through references, imports, and partial applications, and completion at a call offers the callee’s labeled parameters. Hovering a parameter or a call label shows the parameter’s constraint, and a position inside a function literal is no longer treated as part of the value of the field the literal belongs to.
Encodings
The YAML decoder no longer swallows the key following a sequence which ends with an empty entry and is not indented relative to its own key.
The JSON Schema decoder no longer keeps a repeated allOf conjunct twice when merging changes it, such as a disjunction holding a nested allOf. The syntax returned by encoding/jsonschema’s Extract and ExtractCRDs and by encoding/protobuf’s Extract now follows the style of cue/format.Simplify, with labels unquoted where possible, so that Go API users see the same CUE that cue import prints (#4117).
Go API
cue/load.Config.LanguageVersion sets the fallback language version for input which belongs to no module, as the --language-version flag does, and the new cue/build.Instance.TargetLanguageVersion reports the version which cue.Value.Syntax targets for an instance.
Programs embedding CUE could be far larger than necessary, as the text/template builtin and cue/stats looked up methods by name, which stops the Go linker from discarding unused exported methods anywhere in the binary; one reported binary was 66MiB rather than 25MiB (#4514). cue/stats no longer does so, and building with the cuenotemplate build tag leaves the text/template package out of the standard library so that the linker discards unused methods again, at the cost of CUE code importing text/template failing.
All changes
275 changes since v0.18.0-rc.1by area
aec4f3
aec4fdocs: tag function-contracts-callers-providers-and-bridgesaec4fdocs: route to specifyaec4fdocs: declare function-contracts-callers-providers-and-bridges
all11
alldrop leftovers from fixed upstream bugsallbuild costly package-level values on first useallbuild package-level paths without parsing themalladd the @version file attribute for CUE outside a moduleallgenerate String methods which missed constants with stringerallmark test helpers with t.Helperalluse t.Context in testsalluse b.Loop in benchmarksallenable staticcheck's U1000 checkallmark deliberate uses of deprecated APIsalluse internal/value.Context over the deprecated Value.Context
cmd27
cmd/cuetest mod tidy --check on an untidy module with a replacecmd/cuetest the login device flow in-process under synctestcmd/cuetest that login polls once per intervalcmd/cuemake the get go Sizeof test independent of GOARCHcmd/cuepurge function bodies and literals before parsing for get gocmd/cueskip a cue struct tag which is not a valid expressioncmd/cuetest a cue struct tag which is not a valid expressioncmd/cuetest the stats which cue def reportscmd/cue/cmdbuild the registryconfig help text with fewer allocationscmd/cueadd --language-version for CUE outside a modulecmd/cue/cmdrun the test binary as cue in TestInterruptcmd/cue/cmdlocate pprof once in the pprof testscriptcmd/cue/cmdlet testscript Go builds hit the build cachecmd/cue/cmd/integrationmove TestFormatFile into the workspace packagecmd/cue/cmd, pkg/tool/httpcompile two regular expressions lazilycmd/cuereport a command's errors when it has no taskscmd/cuetest cue cmd with comprehensions which fail to declare taskscmd/cue/cmdnote the Go version that lifts the TestVersion skipcmd/cue/cmdupdate pflag to drop the IsBoolFlag workaroundcmd/cue/cmd/integration/workspacemake test failures clearercmd/cue/cmdfail TestInterrupt when the command ignores SIGINTcmd/cue/cmd/integration/workspacefix a log pattern that never matchedcmd/cuefix copy-paste mistakes in testscmd/cueunhide cue mod upgradecmd/cueupgrade and fix every file of the module, loading nothingcmd/cue/cmdreplace deprecated cobra SetOutput in testscmd/cue/cmd/integration/workspacetest two modules as folders
cue51
cue/buildremove Instance.parent, unused since 2018cue/loadjoin relative package arguments as OS pathscue/loadtest relative package arguments with a Windows directorycue/parserkeep the experiments error from ParseExprcue/parserreturn a partial result from ParseExpr on errorcue/parseradd a test for the result of ParseExpr on errorcue/parserrecover from an empty index expressioncue/parseradd tests for an empty index expressioncue/parsermark a line comment at the end of a filecue/parseradd a test for a line comment at the end of a filecue/literalquote DEL as \x7f in bytes literalscue/literaldo not panic on a surrogate escape in an unterminated stringcue/literaladd a test for a lone surrogate escape in Unquotecue/scannergive a specific error for curly quotation markscue/scannerreport a specific error for UTF-16 inputcue/scanneradd a test for scanning UTF-16 inputcue/scannerreset all state in Initcue/scanneradd a test for Init not resetting all statecue/testdatatest unifying separately tightened builtinscue/testdatatest a deduplicated disjunct keeping its replaced IDscuedecode integers into uintptrcue/statscount the edges requested when sorting fieldscuecount the contexts which export a value in the stats totalscue/testdatatest the cost of a dependency graph typed by a definitioncuesee through structure sharing in Value.Err and Value.Lencue,cmd/cuetest Err and Len through structure sharingcuetest exporting a closed definition after a skipped definitioncue/loadadd Config.LanguageVersion for CUE outside a modulecue/cuecontexttest dead code elimination in an embedding programcue/statswrite Counts.String without text/templatecue/astextend a function literal missing its ")" to its last parametercue/astrecord where a function literal missing its ")" endscue/parsertest nesting depth limits just past themcue/loadstop adding overlay parent directories once one existscue/inject/wasmstop reading the deprecated ast.Func.Args fieldcue/loaddrop or fix two checks which tested the wrong variablecue/testdata/evaltest validators of a used scalar of an inline struct or letcue/errors,unstable/encodingregistrydescribe tests in the present tensecue/formatkeep [string]: _ where string may be shadowedcue/formattest the Ellipsis rewrite with string bound locallycue/formatkeep import and package quoted at the top level of a filecue/formattest unquoting import and package labels at the top levelcuefix checks in Decode, Default, and LookupPath testscue/parserremove empty table testscue/inject/wasmreturn errors from the testscript setupcue/...fix copy-paste mistakes in testscue/loadkeep every package a wildcard matchescue/loadtest that ./... keeps the packages it matchescue/literalkeep the leading zero of a signed numbercue/literaltest parsing zeros with a sign or multipliercue/parserremove the no-op safePos
encoding15
encoding/yamltest an empty entry ending an unindented sequenceencoding/jsonschemamerge a conjunct before checking for duplicatesencoding/jsonschematest a repeated conjunct holding a nested allOfencoding/jsonschemamove the struct builder to an internal packageencoding/jsonschemacover allOf merging and version sets via txtarencoding/jsonschemabuild each external test instance onceencoding/jsonschemafix the errors for dependency values of wrong kindsencoding/jsonschematest dependency keywords given the wrong kindsencoding/jsonschemakeep test skips found by description when vendoringencoding/protobufproduce syntax in the style of format.Simplifyencoding/jsonschemaproduce syntax in the style of format.Simplifyencoding/protobuf/...stop tests after a reported errorencoding/jsonstop a pointer test from panicking on a nil errorencoding/...fix copy-paste mistakes in testsencoding/jsonschemaremove unused code
internal97
internal/cuetest, internal/tdtestremove helpers unused for a yearinternal/mod, mod/modcache, internal/robustioremove dead codeinternal/encoding, encoding/jsonschemaremove code unused for a yearinternal/core, internal/pkgremove code unused for over a yearinternal/core/adtremove code unused for over a yearinternal/mod/modloadkeep the not-tidy error with a module replaceinternal/cueconfigsend token requests without client credentialsinternal/golangorgx/gopls/lsprpcstop dialing when the context is doneinternal/golangorgx/gopls/lsprpctest dialing with a done contextinternal/golangorgx/gopls/lsprpcdial auto-started daemons with backoffinternal/lsp/cachesize Windows path buffers in UTF-16 unitsinternal/core/compileshare the predeclared numeric rangesinternal/core/adtremove TestScheduler and the code only it reachedinternal/core/adttest the empty node externallyinternal/core/adtcheck the counter indices of conditions at compile timeinternal/core/adtmove tests on the exported API to adt_testinternal/core/adtcompare function types nested in parametersinternal/core/adtreport errors arising in a call at the calling fieldinternal/core/adtdo not unify distinct function implementationsinternal/core/adtremove ExternalFuncinternal/core/adtcheck callback entitlement and declare builtin resultsinternal/core/adtcheck declared compatibility of function implementationsinternal/core/toposortkeep the frontier between batches free of duplicatesinternal/core/toposorttest sorting fields across empty unificationsinternal/core/toposortrecord export stats in the txtar testsinternal/core/adtfinalize a shared forward reference before a disjunctioninternal/core/adtstop evaluating a disjunct's arcs once one failsinternal/core/adtkeep sharing through a disjunction of typesinternal/core/adtkeep sharing a reference unified with its definitioninternal/cuetxtaradd the shareID:todo form of the sharing assertioninternal/core/adtprint rune by nameinternal/core/exportqualify shadowed predeclared numeric typesinternal/core/exporttest the printing of predeclared numeric typesinternal/core/exportbalance inDefinition when skipping struct fieldsinternal/core/adtfix two discarded return valuesinternal/golangorgx/goplsfold pathutil into protocolinternal/core/adtcomplete nodes read through a let once the referrer is knowninternal/mod/modpkgloadstat a path which fails to read as a directoryinternal/mod/modpkgloadtest a submodule file on a non-OS file systeminternal/mod/modpkgloadtreat ENOTDIR as no directoryinternal/mod/modpkgloadtest a file at the path of a submoduleinternal/lspreport @version attributes in module filesinternal/core/adtwrite the debug graph page without html/templateinternal/lsp/hovershow parameters and stop at function literalsinternal/core/adtshare forward references into closed structsinternal/core/adttest sharing of a forward reference into a closed structinternal/tdtestfind table entries without go/packagesinternal/vcsignore the system git config in TestEnvinternal/cuetxtarpropagate field coverage with a worklistinternal/cuetxtarpermute compiled declarations instead of the ASTinternal/vcsdisable git's auto maintenance in TestEnvinternal/cuetestmove CUE_FORMAT_TXTAR into its only userinternal/cidrop the CUE_UPDATE=1 cross-check runinternal/cuetestunexport the update-only and drop the diff-only predicateinternal/cuetestroute every golden update through shared sinksinternal/astinternalappend to the debug output without fmtinternal/ci/checksread the commit with a single git commandinternal/golangorgx/tools/jsonrpc2write each framed message at onceinternal/mod/modpkgloaduse path.Join for an io/fs symlink statinternalfix two unhelpful panic messagesinternal/core/compileresolve "__" range aliases in LookupRangeinternal/tdtestload dependencies from export datainternal/tdtestreport mismatches whose field cannot be namedinternal/tdtesttest mismatches whose field cannot be namedinternal/tdtestfix updating integer fields and rows without keysinternal/tdtesttest updating fieldsinternal/cuetxtarread the body of the CUETXTAR_GC_URI responseinternal/core/adtcheck validators of a scalar once its conjuncts are ininternal/encodingdo not mutate the caller's Config in NewDecoderinternal/encodingtest that NewDecoder keeps the caller's Configinternal/encoding/yamlreturn errors for invalid literalsinternal/encoding/yamltest encoding invalid number and string literalsinternal/core/adtwrap a failed dynamic field key's error onceinternal/ci/checksmark test helpers with t.Helperinternal/core/export,pkg/internal/builtintestdo not modify export.Allinternal/diffrequire memoization to fire in TestMemoizationinternal/taskmake two test checks able to failinternal/core/adtremove the unused DebugDeps flaginternal/lsp/rangesetcompare TestAdd against literal rangesinternal/lsp/fscachedrop a token.File check which cannot failinternal/httplogclose test serversinternal/anyuniqueremove a test which only exercises maphashinternal/cuetdtestforbid tests from enabling table updatesinternal/cuetxtarremove a duplicate test caseinternal/_e2efix copy-paste mistakes in testsinternal/core/...fix copy-paste mistakes in testsinternal/taskdo not keep a task's value in its runnerinternal/tasktest that a chain of tasks releases earlier configurationsinternal/core/adtclear the buffers of recycled nodeContextsinternal/core/adttest that an OpContext releases earlier evaluationsinternal/mod/modimportslet AllModuleFiles take optionsinternal/core/convertkeep every digit of a big floatinternal/core/converttest converting precise big floatsinternal/pkgreport marshaling errors without a CUE errorinternal/valuedo not allocate in Context for a cue.Valueinternal/cuetxtarremove unused position formatting hookinternal/core,tools/trimremove unused code
mod6
mod/modregistrytestadd Www-Authenticate via ociserver's WriteErrormod/modulecheck the major version with no regular expressionmod/modconfigmove the User-Agent transport out of internal/cueversionmod/modconfigclose test servers and avoid a hang on failuremod/modcachedo not call FailNow from fetch goroutinesmod/modfilefix copy-paste mistakes in tests
pkg10
pkg/tool/filetreat a path below a file as missing in RemoveAllpkg/tool/filetest RemoveAll on a path below a filepkgadd a cuenotemplate tag so the linker can discard unused methodspkg/listturn the Range Go tests into a txtar casepkg/encoding/openapiturn TestMarshalSchemaError into a txtar casepkg/mathtake the MultipleOf remainder in the exact contextpkg/tool/fileremove dangling symlinks in RemoveAllpkg/tool/filetest RemoveAll on a dangling symlinkpkg/...fix copy-paste mistakes in testspkg/encoding/openapireplace deprecated openapi.Gen
private12
private/cmd/projectorupdate scripts via cuetest.UpdateScriptsprivate/internal/projectionconfigure fixture git globally in testsprivate/internal/projectionlist HEAD's blobs once in the agreement testprivate/internal/projectionrun the build gate only in its own testsprivate/encoding/cue/wiredescribe tests in the present tenseprivate/internal/projectionmake the classify/lint agreement cases realprivate/cmd/projectorexit 2 on usage errorsprivate/cmd/projectorvalidate directory expansion and JSON outputprivatereport classification provenance in classify answersprivate/cmd/projectorcomplete the classify output goldensprivate/cmd/projectorsupport updating the script test goldensprivate/internal/projectionstop creating release tags
specs12
specs/aec4frecord the second to fourth review roundsspecs/aec4fprocess review comments and record the posting-ready proposalspecs/aec4fdisallow composing distinct implementations (D-005)specs/aec4frecord increment 2 and reconcile the catalogspecs/aec4frecord the first increment and reconcile the catalogspecs/aec4f/specifyspecify function contractsspecs/aeeg6specify language version selection for CUE outside modulesspecs/adn4breconcile the catalogspecs/adn4bspecify and plan functions in the LSPspecs/ad41p/tasksrecord the completed validation phasespecs/ad41p/tasksreconcile the task list with the landed codespecs/acqavtag releases by hand rather than from declarations
tools10
tools/fixrecord @version when adding an experiment outside a moduletools/fixwiden closings below an open literal or a definition pathtools/fixadd tests for closings below an open literal or a definition pathtools/flowfix a goroutine leak and a panic in teststools/flowrelease earlier configurations as tasks completetools/flowtest that earlier configurations are releasedtools/fixadd the missing out/errors.txt sectionstools/fixleave a definition's aliased body unwrappedtools/fix,cue/ast/astutilreport every file that fails, not just the firsttools/fixmaintain the out/errors.txt section of the fix archives again
unstable7
unstable/lsp/evalresolve labeled arguments to parametersunstable/lsp/evalreplace exactly the path element a completion is forunstable/lsp/evalrecord completion ranges for path elementsunstable/lsp/eval, internal/lspresolve names inside function literalsunstable/lsp/eval, internal/lsprecord behavior inside function literalsunstable/lsp/evalassert non-nil values before using themunstable/...fix copy-paste mistakes in tests
Other14
- update goccy/go-yaml and go-internal to their latest master
ee/cue/gofuncregister Go functions as builtins with declared signaturesadn4bdocs: declare functions-in-the-lsp- update apd to its latest master
- update apd to its latest master
CONTRIBUTING.mddefine an agreed approach and ask for reproducers- update x/tools to its latest master and staticcheck to v0.8.2
- update go-digest to its latest master
CLAUDE.mdnote the Go version that lifts the go mod tidy workaroundCLAUDE.mdpoint at the classify query for debugging the lint.claude/skills/projectionuse the bot accounts for two pushes onlyae052record the implementation, the reviews and the corpus runsae052specify and plan cue mod upgrade for real modules.claude/skills/projectionpush as the project's bot accounts
Downloads
Every file this release published, with its SHA-256. Most people install CUE as Installing CUE describes, which also shows how to check a download.
Installers
| Platform | File and SHA-256 |
|---|---|
| macOS, Apple silicon and Intel | cue_e1a3298bd568244032cbedebcdae132fa23a5aebd14903c361afa15fb28579bd |
| Windows, x86-64 | cue_ca4678931aabcbade80acdba19d3ee3ed00d9c2c4da786a61aaff133fef4acae |
| Windows, Arm64 | cue_4b63b38e908264c3b14c6b86e79eecf4f3b44fb12ec96f2deee24c07fb227709 |
Archives
| Platform | File and SHA-256 |
|---|---|
| macOS, Intel | cue_6e908054791da5aeb8e18307d1cf8e67b4fe7489f7eabd2bdc5e5af81dc14836 |
| macOS, Apple silicon | cue_ba3af8cd79bd0b9ec0890d6914668254939ef117a1a9fbc0fb1749d23455010e |
| Linux, x86-64 | cue_5aec8ac2f66cb6377ddc92f3af5b1c44a19fba318b676a5be962b3ec11b61569 |
| Linux, Arm64 | cue_47193ba48743a8bc95565fc35035c7b8cedf3d224273b0baddf829b84b7ef267 |
| Windows, x86-64 | cue_b71c10b27a18645ffa89b36ac247e9d9558aa272caae162d458b9ca856182dcd |
| Windows, Arm64 | cue_8b7c7a509cefcc7e44a49caeaa3495586b57a1d3c9771d515148dfad19410694 |
SHA-256 checksums for all of these: cue_v0.18.0-rc.2_checksums.txt