refactor(frontend): replace legacy semantic analyzer pipeline#52
Merged
Conversation
… type resolution pipeline - Document for-range loop support roadmap, covering range iterator intrinsic contract, shared semantic, compile gate, and CFG/body lowering integration - Document segmented type resolution pipeline to enable source-order local type fact publication for prefix-typed expressions in loops - Outline scope, motivation, non-goals, dependencies, and fact-source references for both plans - Both plans target frontend sema, lowering, type modules and related test paths
…g refresh helper - Add new stage enum, immutable patch record, update payload record, and patch exception to support incremental per-stage fact publication in the segmented type resolution pipeline - Extend the shared analysis data container with patch apply and local binding payload refresh entry points while preserving the existing whole-table publication API - Refactor the local type stabilization and expression type analyzers to delegate local slot binding refresh through the new helper, keeping external behavior unchanged - Harden patch handling: side table snapshot on construct, merge conflict and idempotency enforcement, stage-owner validation, and compiler-only type leak detection for typed fact updates - Broaden the analysis data test coverage and mark the corresponding plan items as completed in the segmented type resolution pipeline doc
…ype resolution pipeline - Introduce a window-bound scratch publication surface carrying the same fact categories as the stable container with scratch-over-stable effective reads and scratch-only writes - Provide window context, patch extraction/drain, and discard semantics so per-stage facts never leak into the stable surface until committed - Reuse shared compiler-only and merge guard helpers from the existing analysis data container to enforce conflict, idempotency, and typed fact safety uniformly - Cover the new scratch/patch/discard surface with focused unit tests - Mark the corresponding plan items as completed in the segmented type resolution pipeline doc
…ation - Add window-level runners so per-stage facts publish to a scratch surface instead of the stable side table - Preserve legacy whole-module entry by draining the patch and replaying stale-clear semantics for owners - Tighten inferred local type backfill to guard-only and defer local slot refresh to the patch commit - Cover scratch publication, commit-time isolation, and guard-only backfill with focused tests - Mark the corresponding plan items as completed in the segmented type resolution pipeline doc
…ce coverage - Add a segmented scheduler driving binding/typing stages via window-scoped patches, keeping legacy whole-phase as the default production path. - Expose a test-only analyzer entry that routes publication through a shared helper so both paths share diagnostics refresh. - Keep local type stabilization on the legacy direct phase, deferring per-window slot visibility to a follow-up root-bounded window stage. - Cover legacy vs segmented side-table and diagnostics parity, including unsupported loop/match/block-local-const behaviors. - Mark corresponding plan items completed and gate the production switch on the remaining root-bounded window execution work.
…dd execution summary - Reframe plan around an interface/body two-layer architecture with source-order body suite resolution, replacing the previous statement-window runner direction. - Demote existing window publication surface and segmented scheduler to legacy comparison assets due to scratch-over-stable contract violations. - Tighten owner boundaries, compiler-only type isolation, and per-owner patch transaction rules for the new overlay/export flow. - Move all patch carriers and local slot update records into a dedicated sema patch package, preserving stable data ownership and merge entrypoints. - Archive the completed exploratory work in a new execution summary to anchor future implementation on verified evidence.
- Mark all phase A checklist items as completed and record completion rationale in the plan - Add whole-module walker state inventory and compiler-only guard payload matrix as phase freeze artifacts - Demote the legacy segmented scheduler to a deprecated comparison entry with updated contract - Narrow the window publication surface test scope to legacy shim API only - Anchor the next phase on the documented patch migration, per-owner transaction order, and shared walker guard
- Introduce interface layer scaffolding that prepares body resolution without leaking typed facts to the stable side table. - Capture body declaration source order, gate registry, typed lexical baseline, and body entry roots as read-only baseline views. - Mark supporting body readiness, gate status, and declaration records as building blocks owned by the new phase. - Cover boundary contract with focused tests asserting no stable typed publication and fail-closed gate behavior. - Sync the pipeline plan and execution summary with the new surface naming and completed phase items.
…n pipeline - Promote the typed lexical overlay to the main analysis flow with a shared guard covering all source-facing fact publication paths. - Move legacy patch carriers into a dedicated sema patch package and add typed owner-specific transaction primitives with shared walker enforcement. - Wire the interface phase and suite resolver skeleton into the main analyzer after skeleton, scope, and variable inventory stages. - Introduce the statement dispatcher, suite context, and owner retry memo to carry environment dependencies without leaking them through legacy paths. - Refresh the pipeline plan and targeted regressions to reflect the new phase C and D progress and shadow no-op body integration.
…on pipeline - Remove the legacy owner retry memo carrier and route environment dependencies through the dedicated body owner layer - Introduce body owner procedures as the unified holder for body-level coordination, replacing ad-hoc context plumbing - Tighten suite resolver and chain reduction supports to consume the new owner-driven context with consistent guard semantics - Extend the typed lexical environment and analyzer pipeline wiring so body-bound facts publish through the shared owner surface - Refresh the pipeline plan and execution summary, adding focused regressions covering the new chain reduction and analyzer seams
…d-dependent executable resolution - Promote the inventory gate to a two-axis lifecycle with combined readiness checks so consumers share a single fail-closed fact source. - Index the registry by owner and header root with explicit state transition helpers for support, publish, and unsupported outcomes. - Add a gate classifier hook to the statement resolver and route body owner context through a dedicated suite context and request helper. - Make the visible value resolver consume the shared gate registry across request, boundary, and current-scope lookups instead of ad-hoc probes. - Refresh the pipeline plan and execution summary, and add focused regressions for the new gate registry, suite resolver, and value resolver seams.
…t boundary flush - Freeze the live diagnostic manager at compile-gate entry so upstream facts are captured before the gate runs. - Share the statement boundary flush with the typed fact flush to propagate diagnostics across suite statements. - Add focused regressions covering the snapshot, suite resolver, and analyzer seams. - Refresh the diagnostic manager and compile check analyzer docs to reflect the new boundary contract. - Update the segmented type resolution pipeline plan and execution summary to track the new progress.
…n body owner coverage - Remove the production switch so the new pipeline is the only entry point and move the legacy whole-phase publication to a package-private test bridge - Expand body owner procedures to cover attribute, identifier, literal, and self bindings, parameter slots, and assignment semantic context with shared resolver injection - Report unsupported subtrees, recovery boundary diagnostics, and unsafe builtin constructor warnings through the suite resolver - Suppress redundant static self-binding diagnostics at the compile gate and align body owner facts with the legacy baseline - Refresh the pipeline plan and broaden regressions to cover nested, unsupported, and dual-role type-meta routes
…peline - Drop the legacy segmented semantic scheduler and the test-only whole-phase publication hook so the interface/body pipeline is the sole entry point. - Route assignment target prefix expressions through body owner procedures with shared resolver guard semantics. - Suppress duplicate diagnostics for receiver-rooted assignment targets and align body facts with the legacy baseline. - Refresh the pipeline plan, execution summary, and related module docs to reflect the retired scheduler and expanded target coverage. - Tighten regressions around target resolution, suite resolver, and analyzer seams.
…nventory guard - Route source-facing typed slot lookups through the Interface-layer baseline instead of scope slot types. - Cross-check resolved scope locals against published body inventory by declaration identity. - Plumb the baseline and index through the suite environment, owner procedures, and resolver seams. - Cover the new baseline, inventory guard, and resolver wiring with focused regressions. - Refresh the pipeline plan and execution summary to track the new binding.
…ifecycle - Reframe callable parameter slot publication as a callable-entry step sharing the statement-local owner stage. - Rename the overlay flush and parameter helpers to reflect the boundary-agnostic overlay lifecycle. - Update the pipeline plan and execution summary to document the callable-entry pre-publication contract. - Cover the callable-entry behavior with focused regressions and refresh the existing overlay tests.
- Introduce a callable-scoped export batch that collects per-owner patch transactions from root and nested suites and applies them only after the root callable returns. - Keep child overlays isolated from the parent environment so cross-suite stable publication is impossible mid-resolution. - Treat property initializers as independent roots that apply their transactions directly without joining a callable batch. - Update the pipeline plan and execution summary to document the deferred-publication contract and refresh regressions to cover the new boundary.
… analyzer - Drop all public constructor overloads that accepted discarded legacy owner analyzers and clean up the dead constructor chaining in the remaining active-phase entry points. - Reorient framework tests from "assert legacy analyzer not run" probes to verifying the default suite resolver publishes body facts while preserving phase-boundary diagnostics. - Refresh the segmented pipeline plan with the completed legacy-owner constructor removal and outline the follow-up phase for retiring the whole-phase comparison path and migrating test baselines.
…urface - Drop the legacy window-scoped publication scaffolding and dedicated analyzers in favor of the body owner pipeline. - Relocate remaining patch carriers and test seams onto the new body owner lifecycle entry points. - Refresh the pipeline plan and execution summary to mark the legacy comparison path retired. - Add shared body owner test support and broaden regressions to cover the consolidated surface.
…ification - Re-scope from range-only to shared semantic for every for-in body, with iterable type driving iterator slot refinement and lowering route. - Decouple body support from route classification so unresolved iterables fall back to a Variant baseline handled by runtime helper. - Add phases and design sections for iterator declaration identity, iteration plan data structure, generic Variant route, and known iterable specialization. - Extend affected scope to LIR, backend, runtime helpers, and ABI contracts while keeping the range intrinsic as the first route and compiler-only iterator state reserved. - Refresh the test surface layout to match the new shared semantic inventory, suite resolver, and type-check checkpoints.
…antics - Separate lexical inventory and body entry from type refinement, route selection, and compile readiness. - Split iteration rollout into baseline semantic entry, later refinement, and an interim compile safety boundary. - Retire typed-dependent lifecycle gates while preserving fail-closed boundaries for unsupported syntax. - Document ordered export as non-atomic without cross-transaction preflight or rollback.
…ory gates - Replace typed-dependent body readiness gates with structural completeness checks and a static support policy. - Publish loop iterator inventory and resolve for bodies through the ordinary suite entry path. - Keep header typing independent of body entry so unresolved iterables still admit a baseline Variant path. - Block compile mode at the for root until CFG and lowering land, while refreshing docs and regressions.
- Require bidirectional agreement between published locals and the body declaration inventory before suite resolution begins - Enforce contiguous source-order facts that follow AST range order across ordinary locals and loop iterators - Pin loop-body inventory shape so the iterator leads the list while ordinary locals follow contiguously - Fail fast on missing reverse inventory, reordered source order, or malformed iterator placement - Refresh pipeline docs and regressions for the strengthened structural certificate
…tion claim - Introduce isSupportedSuiteBodyRoot() as the single semantic entry shared by the Interface-phase suite-entry decision and the structural completeness first certificate gate - Remove the dead VARIABLE_INVENTORY_NOT_PUBLISHED deferred reason and the obsolete ForStatement unsupported binding/chain reporting from owner procedures - Retract the D0 completion claim in the for-range plan: bare range(...) header pre-route is specified but not yet landed - Add focused regressions covering the new body-entry semantic entry across all block and callable scope kinds
…ic PR boundary for range/int route - Define loop-carried iterator state as graph-owned dedicated hidden slot, not CFG value id or MergeValueItem extension - Add atomic next-PR boundary requiring C/D0/D1/E/G/H closure before compile gate unlock - Specify FrontendForIteratorStateSlot registry, four for-loop CFG items, and cross-table validation contract - Require distinct next temp with temp-then-commit for next intrinsic to preserve future destroyable state lifecycle - Expand CFG/lowering test surface with hidden-slot validation, boundary negative tests, and source-order isolation
…th and refresh for-range plan - Replace the segmented pipeline plan with a concise implementation doc retaining only invariants, core design, risks, and completion criteria - Strip completed phase logs (A-L) and transitional asset classification from the pipeline doc - Reorganize the for-range plan: compress completed phases A/B, add atomic PR boundary, remove outdated status entries and legacy pipeline references - Clean transitional language from code comments that referenced specific migration phases or legacy analyzer paths
- Replace legacy segmented test support with suite resolver stage infrastructure - Update focused analyzer regressions to use the consolidated pipeline - Add explicit null-safety checks and null-safe diagnostic comparisons - Document intentional test helper parameter reuse for clean IDE inspections - Verify compilation and targeted frontend test coverage
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
This PR replaces the legacy whole-module frontend semantic analyzer pipeline with an interface/body architecture that resolves supported suites in source order. It centralizes statement-local semantic ownership, typed lexical overlays, and ordered patch export while preserving fail-closed compiler and diagnostic boundaries.
What changed
FrontendInterfacePhaseand immutable interface surfaces for body declaration inventories, typed lexical baselines, and supported suite-entry roots.FrontendSuiteResolver,FrontendStatementResolver, andFrontendSuiteContextto drive source-order body resolution.FrontendBodyOwnerProceduresto consolidate body-level binding, local type stabilization, chain binding, expression typing, and variable-type post-processing.FrontendTypedLexicalEnvironmentand thefrontend.sema.patchpackage for owner-scoped overlays, ordered transactions, callable export batches, conflict detection, and compiler-only type guards.for-inbody inventory and iterator publication.Why
for-inbodies now enter shared semantic resolution from structural inventory rather than being rejected by typed-dependent readiness gates; compile-only blocking remains explicit until CFG and lowering support is implemented.Affected packages/files
src/main/java/gd/script/gdcc/frontend/sema/- interface surfaces, declaration inventory, structural completeness, typed lexical environment, and analysis data patching.src/main/java/gd/script/gdcc/frontend/sema/analyzer/- interface phase, suite/statement resolvers, body owner procedures, and analyzer integration.src/main/java/gd/script/gdcc/frontend/sema/patch/- owner patches, transactions, export batches, and publication guards.src/main/java/gd/script/gdcc/frontend/sema/resolver/- visible-value resolution through typed overlays and declaration indexes.src/main/java/gd/script/gdcc/frontend/scope/andsrc/main/java/gd/script/gdcc/frontend/lowering/pass/body/- supporting API and cleanup changes.src/test/java/gd/script/gdcc/frontend/sema/andsrc/test/java/gd/script/gdcc/frontend/sema/analyzer/- pipeline, patch-contract, suite-resolution, and migrated analyzer regressions.doc/analysis/anddoc/module_impl/frontend/- implementation source of truth and design documentation.Validation
./gradlew classes --no-daemon --info --console=plain./gradlew test --tests gd.script.gdcc.frontend.sema.FrontendAnalysisDataTest --tests gd.script.gdcc.frontend.sema.FrontendBodySemanticSupportPolicyTest --tests gd.script.gdcc.frontend.sema.FrontendInterfacePhaseTest --tests gd.script.gdcc.frontend.sema.FrontendSuiteResolverTest --tests gd.script.gdcc.frontend.sema.FrontendTypedLexicalEnvironmentTest --tests gd.script.gdcc.frontend.sema.FrontendSemanticAnalyzerFrameworkTest --tests gd.script.gdcc.frontend.sema.analyzer.FrontendCompileCheckAnalyzerTest --tests gd.script.gdcc.frontend.sema.resolver.FrontendVisibleValueResolverTest --no-daemon --info --console=plainResult:
BUILD SUCCESSFULRisks / Notes
for-inshared semantic inventory and body entry are supported, butFrontendForIterationPlan, route-aware compile unblocking, CFG construction, and lowering are not part of this PR.constsubtrees remain explicit unsupported/deferred boundaries.range(...)routing and generic/specialized iterator lowering remain follow-up work; no backend or LIR runtime behavior is changed here.FrontendAnalysisPatchExceptionas total-analysis failure.Key behaviors covered
for-inbody semantic entry with an explicit compile-only blocker until lowering support lands.Diff stats
Breaking changes
Related docs
doc/analysis/frontend_segmented_type_resolution_pipeline_execution_summary.mddoc/module_impl/frontend/frontend_resolution_pipeline_implementation.mddoc/module_impl/frontend/frontend_for_range_loop_implementation_plan.mddoc/module_impl/frontend/frontend_rules.md