Skip to content

Add generic named type instances - #97

Merged
itsfuad merged 3 commits into
mainfrom
feature/generic-named-types
Aug 25, 2026
Merged

itsfuad merged 3 commits into
mainfrom
feature/generic-named-types

Conversation

@itsfuad

@itsfuad itsfuad commented Aug 23, 2026 •

Copy link
Copy Markdown
Member

Summary

  • parse explicit named-type applications, nested type arguments, imported applications, and multi-segment qualified paths
  • add declaration-owned type parameters and one canonical substitution path for structs, enums, interfaces, and transparent aliases
  • cache concrete instances by declaration and semantic argument identity, including recursive pointer/reference shells and owner-module reset
  • preserve nominal enum identity while retaining existing struct and transparent-alias compatibility
  • carry concrete applications through typechecking, HIR, MIR, LLVM, LSP hover, and bundled source fixtures
  • reject type arguments on value paths because generic functions and values remain deferred

This PR is stacked on #88. It does not add public named-enum declarations, construction, is tests, or match syntax.

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
  • CCACHE_DISABLE=1 GOCACHE=/tmp/peeper-go-cache PEEPER_BIN="$PWD/build/bin/peeper" go test -count=1 ./x_test
  • git diff --check

Deferred work

Rules check

No pass-through compatibility wrappers, stale aliases, ignored parameters, duplicate type walkers, or parallel lowering paths were added. New path, substitution, traversal, and cache helpers centralize shared semantic invariants.

Cleanup audit

  • Generic declarations are module-owned artifacts and reindexed into fresh incremental contexts.
  • Transparent aliases canonicalize before instance identity; exact recursive applications reuse provisional shells while expanding/transformed recursion diagnoses and fails cleanly.
  • Added regressions for recursion termination, alias identity, cache reset, and LSP module reuse.
  • Owning-branch commit: ed74835; includes forward merge of Add shared tagged variant core #88.

Parse explicit type applications and multi-segment qualified paths while preserving comparison and shift parsing.

Resolve declaration-owned type parameters through one syntax conversion path, cache concrete instances in CompilerContext, and purge owner instances on incremental reset. Preserve nominal enum identity and lower concrete struct and interface instances through existing HIR, MIR, and LLVM paths.

Path, substitution, traversal, and cache helpers centralize shared semantic invariants; none are pass-through compatibility wrappers.

Validated with full uncached tests, vet, race tests, compiler build, bundled-binary x_test, gofmt, and git diff checks.
@itsfuad itsfuad moved this from Todo to In Progress in Peeper Roadmap Aug 23, 2026
Persist collected generic declarations on modules so fresh incremental contexts can reindex them. Canonicalize transparent arguments, permit exact recursive shells, and reject argument-changing recursion without poisoning the instance cache.

Unalias centralizes transparent semantic normalization. ContainsInvalid reuses the cycle-safe type graph walker. finishTypeInstance owns provisional publication, invalidation, and waiter wakeup.
@itsfuad
itsfuad changed the base branch from feature/tagged-variant-core to main August 25, 2026 17:31
@itsfuad
itsfuad merged commit 5b20a04 into main Aug 25, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Peeper Roadmap Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant