Skip to content

Add generic named type instances - #97

Open
itsfuad wants to merge 1 commit into
feature/tagged-variant-corefrom
feature/generic-named-types
Open

Add generic named type instances#97
itsfuad wants to merge 1 commit into
feature/tagged-variant-corefrom
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.

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.
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