Repository navigation
compiler: conformance cases for qualified references (specification#14) - #17
Merged
Merged
Conversation
added 3 commits
November 16, 2026 09:05
A qualified reference starts with a name a use brought into scope, or with a root (package, parent, self, std, a dependency), as in Rust. New group references, and the codes reference::not-in-scope and reference::qualifier-not-in-scope.
…ares, a dependency's name as a use Every error is reported: imports/bare-own-namespace and the four dependency-named-* cases also expect reference::not-in-scope. New code reference::defined-twice with refused and aliased cases, cases for names and qualifiers nothing declares, and use of a dependency's name alone.
…se still binds its name
Kinflou
marked this pull request as ready for review
November 16, 2026 01:27
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #14. Epic: ComlineProject/core#281. Implemented by ComlineProject/core#290. Decision: Qualified references (docs#189).
The rule the cases hold implementations to
A qualified reference starts with a name a
usebrought into scope, as in Rust, or with a root (package,parent,self,std, a dependency). A reference the rule refuses is an error at once, with the likely rewrite as its fix.New group
references(compiler/src/references.cue->compiler/cases/references.json, 37 cases)usebrings in only its name:namespace-qualified,namespace-alias-qualified:types::Userandt::Userbuild;namespace-bare-refused: a bareUserafteruse package::typesisreference::not-in-scope;namespace-alias-original-refused:types::Userafteruse package::types as tisreference::qualifier-not-in-scope;item-bare,braces-bare,glob-barebuild;item-qualified-refused,braces-qualified-refused,glob-qualified-refusedarereference::qualifier-not-in-scope;no-use-bare-refused(reference::not-in-scope) andno-use-qualified-refused(reference::qualifier-not-in-scope): nouseat all.use:full-package,full-package-nested,full-parent,full-self,full-std,full-dependency; andfull-own-schema-unrooted-refused(shapes::types::Userwithoutpackage::).descend-namespace,descend-alias,descend-dependencybuild;descend-skips-a-segment-refused(api::Invoiceafteruse package::billing).resolved-item,-namespace,-descent,-alias,-full-patheach reachbilling::api::Invoice, and not a decoyInvoiceinarchive(unbounded, so an unmarked protocol using it would bebounds::unbounded);resolved-decoyis the control that reaches the decoy.existing-package-unchanged: a namespaceuseandmodels::Blob, as written before the rule, freezes the same protocols and acknowledgements asbounded/other-schema-marked.Also decided with the user
imports/bare-own-namespacenow expectsimport::bare-own-schema-pathandreference::not-in-scope(a whole-namespace use brings in only its name). No other existing case reports an extra error.imports/dependency-named-std,-package,-parentand-selfkeep their reserved-name expectation alone; their app schema no longer holds the stray bareBlob(it is a plain struct), so each tests only the reserved name. Said in the readme.usethat fails to resolve still brings its name into scope, so it never cascades:imports/unknown-first-segmentis unchanged in outcome (onlyimport::unresolved), and its description and the readme say so.nowhere-bare-refused,nowhere-qualified-refused); a fix that adds auseis offered only where a declaration exists, and each description says whether one is.reference::defined-twice, fix: rename one, or import with an alias. Refused:defined-twice-local-and-use,defined-twice-two-uses. Accepted with an alias:alias-resolves-local-clash,alias-resolves-two-uses.use greetingon its own is accepted:descend-dependency-name.parent::andself::mean in a type position what they mean in ause(readme).Codes
The catalog has no diagnostics section yet, so, as in #12, the codes are the closed list in
specs/compiler.cue(and its generated schema), and the readme table lists each with its fix:reference::not-in-scope: a bare name nothing brought into scope. Fix: adduse package::types::User, or writetypes::User.reference::qualifier-not-in-scope: a qualified reference whose first segment is neither in scope nor a root. Fix: writeUser.reference::defined-twice: a name auseand a declaration, or twouses, define. Fix: rename one, or import with an alias.Three codes (the third,
reference::defined-twice, above).not-in-scopeandqualifier-not-in-scopeare two because the two refusals have different fixes, which tooling attaches by code. Familyreference::because the error is on a type reference, not on ause(import::).What the format can't say
ir_hashis an input). The cases show freezing through what a spelling reaches (the decoy's bounds), and the unchanged package through its protocols' given-up sets and acknowledgements. A field for frozen references would be a format change.{ code, severity }; the fix is in the description and the readme table, not matched.Existing cases
Only
imports/bare-own-namespacechanges its expected errors; the fourdependency-named-*cases change their schema text (no strayBlob) andunknown-first-segmentits description, with the same outcomes as before. Everything else keeps its outcome: itemuses,package::modelsthenmodels::Blob,stdand dependency paths stay accepted.Checked
specs/check.sh --checkis clean. The cases are not run against core: they are ahead of it (core#290), and the readme says so.