Skip to content

Add optional narrowing and payload access - #87

Merged
itsfuad merged 2 commits into
mainfrom
feature/optional-narrowing
Aug 25, 2026
Merged

itsfuad merged 2 commits into
mainfrom
feature/optional-narrowing

Conversation

@itsfuad

@itsfuad itsfuad commented Aug 23, 2026 •

Copy link
Copy Markdown
Member

Summary

  • add module-owned FlowTyped results between CFG and definite initialization
  • narrow stable optional variables, fields, nested projections, constant indexes, and resolved binding indexes across full CFG fixed points
  • preserve carrier types in explicit optional contexts while exposing inferred payload types at proven uses
  • invalidate facts through assignments, aliases, index dependencies, calls, raw pointers, globals, and scope exit
  • make ownership consume flow payload/origin evidence and lower presence/payload operations explicitly through HIR, MIR, and LLVM
  • publish refined hover types and flow diagnostics through incremental LSP snapshots

Ownership boundary

  • copyable and shared-reference payload reads preserve optional carrier
  • moving move-only payload from direct named local or parameter consumes whole carrier and supports reinitialization
  • move-only extraction from fields, indexes, pointees, and other partial places remains rejected

Representation boundary

  • every optional remains tagged {present, value} in this PR
  • niche representation remains separate in Add optional niche layouts #30
  • no Some, unwrap, fallback, chaining, patterns, optional equality, or other new 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

Closes #28.

Follow-up: #31 can use delivered optional payload contract for iterator next -> ?T; #30 remains open for niche layouts.

Cleanup audit

  • Hardened full-CFG optional facts, origin propagation, dependency invalidation, ownership evidence, and incremental LSP behavior.
  • Added regressions for nested proofs, aliases, indexes, mutable/raw-pointer invalidation, reinitialization, and tagged ABI on 32/64-bit targets.
  • Owning-branch commit: c1764e0; parent of the remaining stacked PRs.

Insert FlowTyped between CFG and ownership consumers, centralize effective expression types and carrier/value place resolution, and lower optional presence and payload operations explicitly through HIR, MIR, and LLVM.

Module.EffectiveExprType, place.Resolve, and PayloadOrigins centralize shared flow/place invariants; no compatibility wrappers or parallel walkers remain.

Validated with uncached go tests, go vet, race tests, build script, bundled x_test fixtures, formatting audit, and git diff --check.
@itsfuad itsfuad added this to the 0.2 Language Foundations milestone Aug 23, 2026
@itsfuad itsfuad moved this from Todo to In Progress in Peeper Roadmap Aug 23, 2026
@itsfuad
itsfuad merged commit 5525149 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.

Add optional narrowing and payload access

1 participant