Repository navigation
DDIR: enum declares sums, and type declares erased aliases - #1087
Merged
frankmcsherry merged 2 commits intoNov 13, 2026
Merged
Conversation
`enum Name = V0 shape? | V1 shape? | …;` declares a sum, with the variant syntax `type` used before. `type Name = shape;` now declares an alias, which resolves to its shape wherever a declared name may appear: input, import, var and output declarations, and enum payloads. Enums stay structural, and aliases erase, so the language stays structurally typed. Enums and aliases share one namespace, may refer to each other in any order, and a cycle through either is an error. `type X = A | B;` is an error that points to `enum`. An alias inside a lambda fails with a message saying aliases are not yet available there, because corgi parses lambda ascriptions and has no aliases. Every sum declaration, the plan printer, the language reference and the README use `enum`, and the plan-pair snapshots are regenerated; they differ only in the keyword. Co-Authored-By: GPT-6 Sol (Codex) <noreply@openai.com> Claude-Session: https://claude.ai/code/session_01H6wB4H99TLw4tqu4x48pXL
… at `enum` `type int = float;` was accepted and ignored, since `int` resolves before declared names. Declaring `int`, `float`, `List`, `Option` or `Result` as an enum or an alias is now an error. An alias must be one shape followed by `;`, so `type Node = Node List(int);` now gets the hint that sums are declared with `enum`, rather than "Expected Semi". Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H6wB4H99TLw4tqu4x48pXL
frankmcsherry
marked this pull request as ready for review
November 13, 2026 22:36
frankmcsherry
added a commit
that referenced
this pull request
Nov 14, 2026
#1088's new test declared `type Member = User int | Group int;`, written before #1087 made `type` an alias and `enum` the sum declaration. The two merged separately, so master-next failed two tests in `tests/flatmap.rs`. Claude-Session: https://claude.ai/code/session_01H6wB4H99TLw4tqu4x48pXL Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
enumnow declares sums andtypedeclares aliases, sotype Text = List(int);andtype Pair = (int, int);name structural shapes.A draft: the change is complete and tested; aliases inside lambdas wait on a corgi change.
The language
input,import,varandoutputdeclarations, and enum payloads.type X = A | B;fails with "sums are declared withenum, nottype". The old spelling is not kept.enummatches the text corgi already uses for sums (enum Name = … in …inside lambdas, and DDIR's declarations to corgi'sScope).Inside lambdas
Lambda ascriptions such as
(x : Text)are parsed by corgi, which has no aliases.For now they fail with
unknown enum 'Text'; alias `Text`: aliases are not yet available inside lambdas.A corgi draft adds
type Name = shapeto corgi (frankmcsherry/WIP#149); a DDIR follow-up that hands aliases to corgi is tested against it and waits on moving DDIR's corgi pin.Conversion and checks
binders.ddpandjoin_fallback.ddp.enumhint, the lambda error, and inline corgi enums.cargo test --release -p interactivepasses; all nine example.expectedoutputs match at 1 to 4 workers.Implemented by GPT-6 Sol (Codex); reviewed, tested and opened by Claude Code.
🤖 Generated with Claude Code
https://claude.ai/code/session_01H6wB4H99TLw4tqu4x48pXL