Repository navigation
Conversation
Introduce src/v2.5/std/stage_types.dag with closed-sum ParseModule, ResolvedModule, NormalizedModule, and InferredModule shapes. ExprData's 22 cases are decompressed into per-phase expression coproducts; typing lives as expr_type on InferredExpr variants, not optional inferred fields. Supporting modules: syntax.dag, identity.dag, token.dag (interim contracts). Co-authored-by: Cursor <cursoragent@cursor.com>
Add SurfaceSugarKind, ResolvedSugared/ResolvedCore module items, and SeamResolvedNode/SeamNormalizedNode substrate projection carriers so 03_normalize can target either the full AST or the v4-shaped seam. Co-authored-by: Cursor <cursoragent@cursor.com>
Import node.dag + diagnostic.dag from cool-bee-832 substrate. Drop duplicate Connective/EdgeLabel/Behavior; use 6-case Connective in seam types. Rename param optional to ParamCardinality. Symbol authority moves to node.dag. Co-authored-by: Cursor <cursoragent@cursor.com>
Complete the emit pipeline port pair so the header contract matches the typed stage boundaries through emit. Emit implementation remains Tier 2. Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls
left a comment
There was a problem hiding this comment.
Review metadata
- Provider / model:
codex/unknown - Commit:
bb5b7fca· Trigger:schedule - Thinking:
260s wall
BLOCKING (5)
Root Cause
src/v2.5/04_infer.dagv2.5 stage substrate modules are not landed with the stage implementation → add the v2_5.std.node/stage_types declarations in this PR or bind the prototype to an existing namespace.src/v2.5/04_infer.dagthe prototype declares raw carrier sums before the dissolution classification pass → classify or dissolve each substrate-facing coproduct before landing.src/v2.5/04_infer.dagthe fold output shape separates inferred expressions from their diagnostic list and only carries the expression forward → make InferredExprNode carry diagnostics or have the fold return a diagnostic-preserving result carrier.src/v2.5/04_infer.dagthe child-first fold is being used for binder forms without a pre-child scope hook → make let/lambda/for-each bodies fold under their extended lexical scope.src/v2.5/04_infer.dagrecord literals are modeled as parallel label/value lists at the infer boundary → carry field entries as one edge-shaped field/value carrier or preserve both facts through InferredRecordLit.
| @@ -0,0 +1,826 @@ | |||
| module v2_5.compiler.infer | |||
|
|
|||
There was a problem hiding this comment.
BLOCKING: This new stage imports v2_5.std.node and v2_5.std.stage_types, but the supplied diff adds only this file and origin/main has no src/v2.5/std blobs, so the PR introduces an unresolved module boundary.
| InferredTypeDecl, InferredDataDecl, InferredFuncDecl, | ||
| InferredServiceDecl, InferredTransportDecl, | ||
| NormalizedFoldAlgebra, fold_normalized_node | ||
| } |
There was a problem hiding this comment.
BLOCKING: TypeRef starts a set of new substrate-facing coproducts with no required 🟢/🟡/🔴 classification tags, violating modeling-discipline Practice 4/9 and INVARIANTS P5.
|
|
||
| fn child_expr_node(node: InferredNode) -> InferredExpr { | ||
| match node { | ||
| InferredModule { name: _, imports: _, items: _, exports: _, diagnostics: _ } => |
There was a problem hiding this comment.
BLOCKING: expr_result_node drops ExprInference.diagnostics at the expression-to-node boundary, so collected diagnostics cannot reliably reach InferredModule.diagnostics, violating fail-closed facts-flow discipline.
| ItemInference { | ||
| item: InferredTypeDecl { name: error_symbol, type_ref: diagnostic_type(diagnostic: UnimplementedTypeKitBinding { missing: unknown_type_kit_binding }) }, | ||
| diagnostics: [UnimplementedTypeKitBinding { missing: unknown_type_kit_binding }], | ||
| exports: [] |
There was a problem hiding this comment.
BLOCKING: infer_let extends scope only after the body has already arrived as an InferredExpr child, so let-bound names in the body are inferred under the wrong environment.
| Some { value: actual } => | ||
| infer_error(diagnostic: BranchTypeMismatch { then_type: first_facts.result_type, else_type: actual }) | ||
| None => | ||
| ExprInference { |
There was a problem hiding this comment.
BLOCKING: infer_record_lit receives field labels but constructs InferredRecordLit from only values, silently dropping record field-name facts needed downstream.
|
Verified on current head 8bef6ef: this PR still imports |
|
Verified on current head bc44ed3: |
Replace local node.dag/diagnostic.dag with cool-bee-832 Tier 0 (2-variant NodeKind, PathStep, Nat, PortLocus). Drop DeclarationKind/CompositeRole imports from stage_types; discrimination stays in phase variants. Co-authored-by: Cursor <cursoragent@cursor.com>
bc44ed3 to
948cd92
Compare
|
Closing per operator wrap-up directive 2026-05-20. |
Summary
Rebases
src/v2.5/04_infer.dagonto vivid-lynx-807's reconciled Tier 1 stage-type kit from PR #3418 (dfb926f8c) and binds the stage to the actual current contract:fn infer(module: NormalizedModule) -> InferredModuleThe previous prototype targeted a provisional
NormalizedNode/InferredNode/fold_normalized_nodeAPI that no longer exists after the Tier 1 reconcile. This version keeps the infer stage compileable and fail-closed while recording the missing recursive expression fold and pre-child binder-scope hook as first-class model state.This PR intentionally touches only
src/v2.5/04_infer.dagon top of the Tier 0/Tier 1 v2.5 substrate branches. It does not touchsrc/v2/,src/v3/,src/v4/,dsl/, or Rust.Stage Shape
NormalizedModule, imported fromv2_5.std.stage_types(src/v2.5/04_infer.dag:4).InferredModule, imported fromv2_5.std.stage_types(src/v2.5/04_infer.dag:4).infer(module: NormalizedModule) -> InferredModule(src/v2.5/04_infer.dag:62).infer_readiness = AwaitingRecursiveExprFold(src/v2.5/04_infer.dag:53).binder_scope_fold_status = AwaitingPreChildScopeHook(src/v2.5/04_infer.dag:54).What Dissolved
NormalizedNode,InferredNode,NormalizedFoldAlgebra,fold_normalized_node) is gone from this stage.NodeKinddiscrimination; it imports onlySymbolfromv2_5.std.node(src/v2.5/04_infer.dag:3).ExprDataDissolution,src/v2.5/04_infer.dag:10).InferReadiness,BinderScopeFold) and a closure receipt (InferCarrierClosure,src/v2.5/04_infer.dag:34).Rebase Notes
dfb926f8c, which includes Tier 0 PR v2.5 fork — Tier 0 substrate (std/node.dag + std/diagnostic.dag) #3422's THESIS-faithful substrate.node.dagorstage_types.dagis added here; those remain owned by Tier 0/Tier 1.v2-compiler compile --source-root src/v2.5hung after resolution when the infer module recursively traversedNormalizedExpr. The compileable shape is therefore an honest fail-closed stage boundary until Tier 1 exposes the recursive expression fold / binder pre-child scope hook.Validation
cargo run -p v2-compiler --release -- compile --source-root src/v2.5 --output-dir /tmp/v25-check --target dag— passes; 7 modules indexed/resolved, 0 diagnostics.git diff --check— passes.rg -n "NodeKind|Declaration|Composite|TypeForm \\{|Computation \\{|edge_is_named|edge_is_positional|is_empty_conj_root|expr_data|inferred:|src/v2/|src/v3/|src/v4/" src/v2.5/04_infer.dag— no matches.Honest Yellow List
InferredModulecarries anInferredOtherItemmarker instead of inferred items whileinfer_readinessisAwaitingRecursiveExprFold.src/v2/04_infer.dagat 6063 lines; the large reduction is mostly from refusing to preserve the stale provisional walker rather than from completed inference logic.