Skip to content

Fix recursive inline member ordering in optimizer - #20111

Open
majocha wants to merge 45 commits into
dotnet:mainfrom
majocha:fix-20085
Open

Fix recursive inline member ordering in optimizer#20111
majocha wants to merge 45 commits into
dotnet:mainfrom
majocha:fix-20085

Conversation

@majocha

@majocha majocha commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Recursive inline members in a recursive binding group can depend on siblings that appear later in source order. The optimizer now discovers these dependencies, optimizes bindings in dependency order, and restores source order before emitting the result. Trait-witness dependencies and module-level recursive groups are handled as well, while non-inline recursive groups retain the existing behavior.

Regression coverage exercises recursive inline member access, trait-witness resolution, and the existing Issue 1565 cases. Emitted-IL and AOT baselines are updated for the resulting stable output.

Fixes #1565

majocha and others added 8 commits August 1, 2026 13:12
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
majocha and others added 12 commits August 2, 2026 09:41
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

✅ No release notes required

@majocha

majocha commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

It works. I'll mark as ready for review but I'm not sure the approach here is the best.

@github-actions github-actions Bot added the AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files label Aug 6, 2026

@T-Gro T-Gro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤖 This review was generated by AI (@expert-reviewer agent). Findings may contain inaccuracies — please verify independently.

Comment thread src/Compiler/Optimize/Optimizer.fs Outdated
Comment thread src/Compiler/Optimize/Optimizer.fs Outdated
Comment thread src/Compiler/Optimize/Optimizer.fs Outdated
Comment thread src/Compiler/Optimize/Optimizer.fs Outdated
@T-Gro T-Gro added the AI-reviewed PR reviewed by AI review council label Aug 10, 2026
@T-Gro
T-Gro self-requested a review August 10, 2026 09:11
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added the ⚠️ Affects-Compiler-Output Tooling check: PR touches IL emission or codegen label Aug 20, 2026
majocha and others added 7 commits August 20, 2026 15:21
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the ⚠️ Affects-Bootstrap Tooling check: PR touches compiler bootstrap chain label Aug 24, 2026
@github-actions

This comment has been minimized.

Comment thread src/Compiler/Optimize/Optimizer.fs Outdated
Comment thread src/Compiler/Optimize/Optimizer.fs Outdated
Comment thread src/Compiler/Optimize/Optimizer.fs
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Tooling Safety Check — Affects-Compiler-Output
Affects-Compiler-Output: modifies src/Compiler/Optimize/Optimizer.fs

Generated by PR Tooling Safety Check · opus46 4.9M ·

A single nested ModuleOrNamespaceBinding.Module element previously disabled
the dependency-first optimization schedule for the entire recursive group,
so a non-inline binding forward-referencing an inline sibling (directly, or
through vals in a later nested module) still failed with FS1114/FS1118.

Generalize the schedule to group elements: a nested module publishes all of
its contained vals, and both sides of the dependency edge (bindings that
reference a nested module's vals, and modules whose contents reference
sibling bindings) are tracked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚠️ Affects-Bootstrap Tooling check: PR touches compiler bootstrap chain ⚠️ Affects-Compiler-Output Tooling check: PR touches IL emission or codegen AI-reviewed PR reviewed by AI review council AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Improve diagnostics for inlining in class methods - FS1114, FS1113, FS1116, FS1118

2 participants