Skip to content

Add named enums and exhaustive match - #98

Open
itsfuad wants to merge 5 commits into
feature/generic-named-typesfrom
feature/named-enums
Open

Add named enums and exhaustive match#98
itsfuad wants to merge 5 commits into
feature/generic-named-typesfrom
feature/named-enums

Conversation

@itsfuad

@itsfuad itsfuad commented Aug 24, 2026

Copy link
Copy Markdown
Member

Summary

  • add payload-aware named enum declarations with declaration-owned variant symbols and generic substitution
  • construct fully named local and imported cases through canonical semantic evidence and shared tagged-variant lowering
  • add nonconsuming is tests, case-set CFG narrowing, exact-case fields, and alias-aware invalidation
  • add exhaustive statement match with arm scopes, case edges, definite initialization, ownership transfers, and cleanup evidence
  • preserve carrier ownership for copyable and shared-reference fields while rejecting move-only partial extraction
  • add structured variant constants, typed MIR statics, LLVM aggregate emission, enum FFI rejection, LSP support, fixtures, and documentation

Validation

  • CCACHE_DISABLE=1 GOCACHE=/tmp/peeper-go-cache go test -count=1 ./...
  • CCACHE_DISABLE=1 GOCACHE=/tmp/peeper-go-cache go vet ./...
  • CCACHE_DISABLE=1 GOCACHE=/tmp/peeper-go-cache go test -race -count=1 ./...
  • CCACHE_DISABLE=1 GOCACHE=/tmp/peeper-go-cache bash scripts/build.sh
  • PEEPER_BIN="$PWD/build/bin/peeper" CCACHE_DISABLE=1 GOCACHE=/tmp/peeper-go-cache go test -count=1 ./x_test
  • git diff --check

Boundaries

  • variants require fully named Enum::Variant syntax and never become types or callable constructors
  • struct literals remain .Point{...} and .{...}
  • match remains statement-only, exhaustive, and fully named; no wildcard, guard, alternative, nested, shorthand, or expression forms
  • move-only field extraction remains legal only from direct named local or parameter carriers; partial carriers are rejected
  • LLVM keeps one typed payload slot per data case; compact union storage remains Compact tagged variants into shared union payload storage #92
  • named enums remain rejected in extern signatures until Define explicit enum representation and foreign ABI #96

Stacked on #97. Parent PRs #87, #88, and #97 remain open and unmerged.

Deferred work: #30, #89, #91, #92, #94, #95, and #96.

Parse enum payload schemas, variant literals, is tests, and match statements. Add payload-aware semantic cases, declaration-owned variant symbols, constructor evidence, and shared VariantMake lowering.\n\nCentralize qualified variant path splitting, imported-member diagnostics, and struct/variant field validation so later phases consume one semantic source of truth.
Resolve and typecheck exhaustive match arms through canonical semantic evidence, then build case-labelled CFG edges with definite-init and flow transfer.

Reuse shared case lookup and place origins, and lower copyable pattern bindings through existing HIR/MIR variant switches and payload projections.
Add structured variant constants, typed MIR static evidence, LLVM aggregate emission, nested extern rejection, LSP enum tooling, fixtures, and shipped-language documentation. Resolve static types through canonical ABI keys so nominally distinct enums with the same display name cannot collide.\n\nHelpers are limited to recursive constant storage, ABI identity, typed backend aggregate lowering, nested type traversal, and balanced incomplete-source completion contexts.
@itsfuad itsfuad added this to the 0.2 Language Foundations milestone Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant