Skip to content

refactor(runtime): ask the semantic questions of lowered records - #2252

Merged
HuiJun merged 6 commits into
developfrom
feat/ir-expr-semantic-residues
Nov 15, 2026
Merged

HuiJun merged 6 commits into
developfrom
feat/ir-expr-semantic-residues

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

What and why

No tracking issue.

Based on develop. #2249, which this step was stacked on, has merged; the branch has develop merged in and so contains #2249's merged content, and the diff shows only this step.

Fourth part of the execution-owned expression migration in docs/internals/execution-ir-design.md, after #2218, #2225 and #2249. The runtime no longer hands a syntax tree to the semantic layer: it asks the lowered record.

  • internal/ir/lower/expr_questions.go adds ExprEntry.Folded, Dimension, Held, Classifies and Unit. Each answers from the provenance tree the record keeps, through the unchanged semantic-layer functions (EvalWithin, DimensionOfExpr, ValuesHeldBy, EvalClassification, UnitOfExpr).
  • Every runtime caller of those five functions now goes through the record, Context.UnitOf among them (builtins_named.go, collections.go, compile.go, eval.go, eval_declared.go, instance.go, shape.go, tensor_functions.go, tool.go, write_conformance.go).
  • NoValueError.Ref needed no code change: the error already carries the feature's Symbol. The stale row in the design document is corrected.

Error timing is unchanged. A few helpers that folded a raw tree now lower the expression first; lowering reports no errors and is memoized.

Not in this PR: removing the retained tree fields, moving the semantic-layer signatures off trees, and forbidding exec/runtime from importing syntax/ast are the final step.

Baselines

None moves. The merges of develop were clean, and pilot-apijson-diff -check, derived-census -check -require-exporter and pilot-diff -check reproduce the committed records on the merged head.

How it was verified

On the pushed head (this change merged with develop):

  • go build ./..., go vet ./..., gofmt -l ., make lint
  • go test -count=1 ./... with the training and pilot corpora required, and go test -C tools -count=1 ./...
  • go test ./tests/hygiene, scripts/check-doc-ids.py, scripts/changelog.py check
  • make docs-counts, make spec-compliance-check, make wasm-check
  • pilot-diff -check and pilot-apijson-diff -check (JDK 21), pilot-exec-diff, pilot-xpect -check

New tests in internal/exec/runtime/expr_questions_test.go: TestLoweredRecordAnswersTheSemanticQuestions and TestLoweredDefaultIsTheOneAFeatureStatesOrRedefines. The existing runtime tests pass unchanged.

Checklist

  • make test and make lint pass locally (the suite was run without -race)
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (docs/internals/execution-ir-design.md)
  • Changelog entry: none, an internal refactor with no user-visible change
  • baselines regenerated: none moved
  • No internal work-item labels in the body, docs, or changelog

🟢 Devin Review found nothing to fix · View findings

Devin Review

devin-ai-integration Bot and others added 3 commits November 14, 2026 10:30
The constant fold, declared dimension and count, classification verdict and unit of an
expression are asked of its lowered record (lower.ExprEntry.Folded, Dimension, Held,
Classifies, Unit) rather than by handing the semantic model a syntax tree.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@HuiJun
HuiJun added this pull request to the merge queue Nov 15, 2026
Merged via the queue into develop with commit 34f6f6c Nov 15, 2026
30 checks passed
@HuiJun
HuiJun deleted the feat/ir-expr-semantic-residues branch November 15, 2026 19:44
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