Repository navigation
Add named enums and exhaustive match - #98
Merged
Merged
Conversation
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.
# Conflicts: # docs/language-spec.md # internal/ir/hir/lower/module_lower_test.go # internal/ir/types.go # internal/semantics/place/origin_test.go # internal/semantics/typechecker/check_call.go # internal/semantics/typechecker/flow.go
Centralize transparent alias-to-enum declaration lookup so resolver and LSP completion share canonical variant identity without copied scopes. Record parser-owned match arm-list bounds so completion never replaces subjects or existing arms.
Generalize canonical enum lookup to retain qualifier owner and canonical declaration identity. This shared boundary lets empty-match completion preserve imported transparent-alias spelling while resolver and completion continue using declaration-owned variant symbols.
Resolve named variant syntax through resolver-owned qualifier symbols so cloned defaults keep declaration-module enum identity across construction, case tests, and match arms.\n\nCentralize the shared path/type/case lookup because all three checker consumers must preserve the same cross-module clone invariant.
Stamp compiled contexts with document generation so dependency overlay edits cannot reuse stale enum schemas. Preserve previous contexts for diagnostic replay and keep module-level incremental reuse intact.\n\nCentralize context, metrics, and generation publication because every recompile exit must publish one coherent snapshot.
Treat safe-reference cycles as lowerable indirection while preserving by-value cycle rejection. Stop stored-reference traversal at direct referents so referent fields are not mistaken for embedded carrier storage.
Generalize existing reference liveness into canonical tracked-symbol liveness, then normalize dead direct match carriers at falling arm exits. Keep live mixed joins and drop-bearing overwrite obligations rejected. Helpers centralize direct carrier resolution and payload-move classification shared by match transfer and cleanup planning; no parallel walker or lowering path is added.
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.
Summary
istests, case-set CFG narrowing, exact-case fields, and alias-aware invalidationmatchwith arm scopes, case edges, definite initialization, ownership transfers, and cleanup evidenceValidation
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.shPEEPER_BIN="$PWD/build/bin/peeper" CCACHE_DISABLE=1 GOCACHE=/tmp/peeper-go-cache go test -count=1 ./x_testgit diff --checkgoandfixturesjobs pass at63e4288Boundaries
Enum::Variantsyntax and never become types or callable constructors.Point{...}and.{...}Merged into
mainafter parent PRs #87, #88, and #97.Deferred work: #30, #89, #91, #92, #94, #95, #96, #99, and #100.
Review follow-up
63e4288: dead direct match carriers now normalize per-arm ownership and cleanup before the shared join; later carrier use, drop-bearing overwrite, and partial-carrier moves remain rejectedEnum::Variant with payloadsyntax and remains separate from this PRCleanup audit
63e4288; merged tomainas5a7a5cfafter Add optional narrowing and payload access #87, Add shared tagged variant core #88, and Add generic named type instances #97.