Repository navigation
feat(desugar): type aliases and extern types follow the rule of data types; the signing rule in CLAUDE.md - #436
Conversation
…a types Owner decision 2026-11-10: a module names a `type` alias or an extern type when it declares it, or when it imports the module that declares it. An alias must also be `pub`. An extern type is public, as an extern function is. An import list must name the type. Each module used to see each alias and each extern type of the program, with no import. A data type, an alias and an extern type are now in the one type table of the scope of a module, so a declaration of a name shadows an imported type of each kind. A type that a module cannot name is refused by name: "unknown type `Feet`". No program of the corpus changed. New test: a_module_names_an_alias_or_an_extern_type_only_through_an_import. 624 tests pass; the all-target count is 621. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0136P7ZmKrYLDC4WHi2yt11u
Owner ruling 2026-11-10. The rule said that each commit has a signature of the owner key. Each commit on main is a squash merge that GitHub signs with its own key. The owner key signs the commits that the owner makes on a local computer. A cloud session signs with its session key, and no private key of the owner goes into such a session. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0136P7ZmKrYLDC4WHi2yt11u
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58632c325c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let TypeDef::Data { ctors, .. } = &info.def else { | ||
| imported.types.insert(name.clone(), info.clone()); | ||
| continue; |
There was a problem hiding this comment.
Preserve value imports that share a type name
When a module exports a function and a newly scoped alias or extern type with the same identifier, a selective import of that identifier now records it as a type here, and desugar_module consequently removes the identifier from the core import list. For example, extern "c" { type Handle; fn Handle(n: I32): I32 } followed by import host(Handle) makes the type available but leaves calls to Handle unbound, even though the grammar permits both declarations and the import names that identifier. Track type and value membership separately so importing a type does not suppress a same-named function.
Useful? React with 👍 / 👎.



Summary
2 commits, each from an owner decision of 2026-11-10.
typealias and an extern type follow the visibility rule of data types.CLAUDE.mdsays what is in the repository.1. Visibility of type aliases and extern types
Each module used to see each alias and each extern type of the program, with no import. A data type already followed the rule of functions (#431). Now the 3 kinds of named type have one rule:
pub. An extern type is public, as an extern function is.import lib(Meters, double).app)import libandfn keep(m: Meters): Meters, withpub type Meters = I32inlibimport libandfn keep(f: Feet): Feet, withtype Feet = I32(private) inlibFeetimport lib(double)and a use ofMetersMetersimport mid(wheremidimportshost) and a use of the extern typeHandleofhostHandleA public function with a private alias in its signature stays usable: the importer does not name the alias.
How
The desugarer had 3 tables: data types in the scope of each module, and aliases and extern types for the whole program. A data type, an alias and an extern type are now in the one type table of the scope of a module (
TypeInfo { def, home, public }, withTypeDef::{Data, Alias, Extern}). Thus a declaration of a name shadows an imported type of each kind. The import step drops alias names and extern type names from the core import list, as it does for data types, because the type checker reads each name in that list as a function.No program of the corpus changed.
2. The commit signing rule
CLAUDE.mdsaid that each commit has a signature of the owner key. In fact each commit onmainis a squash merge that GitHub signs with its own key. The new text says:main.Verification
cargo test --workspace: 624 passed, 0 failed.cargo fmt --all --checkandcargo clippy --workspace --all-targets: clean.scripts/status-gate.sh: 621 all-target tests (1 more than before).scripts/probe-battery.sh: 51 SAME, 7 SKIP (the SKIP rows need the wasmtime CLI).a_module_names_an_alias_or_an_extern_type_only_through_an_import(4 programs run as wasm and in the interpreter, 2 programs compile, 4 programs are refused by name).Generated by Claude Code