Skip to content

Optimize inline members of recursive groups on demand - #21017

Merged
abonie merged 3 commits into
dotnet:mainfrom
majocha:fix-21016-rec-inline-on-demand
Nov 23, 2026
Merged

abonie merged 3 commits into
dotnet:mainfrom
majocha:fix-21016-rec-inline-on-demand

Conversation

@majocha

@majocha majocha commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #21016

A member that uses an inline member of its recursive group through an inline function, for example a * x with static member inline (*), failed with FS1114. The trait call that names the inline member appears only after the optimizer inlines FSharp.Core (*), so the dependency order from #20111 could not find it.

The optimizer now optimizes a pending inline sibling at the first lookup of its val, and commits the effect of each element on the optimization state in source order. This replaces the predicted dependency order, so the optimizer again processes recursive groups in source order.

🤖 Generated with Claude Code

A member can use an inline member of the same recursive group through an
inline function, for example `a * x` with `static member inline (*)`. The
trait call that names the inline member appears only after the optimizer
inlines FSharp.Core `(*)`. The predicted dependency order cannot find this
dependency, so the optimizer reported FS1114.

The optimizer now records the inline vals of the group elements that it did
not optimize yet. When a lookup finds such a val, the optimizer optimizes its
element immediately. Each element commits its effect on the optimization
state in source order. This change removes the dependency-order scheduler.

Fixes dotnet#21016
@majocha

majocha commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

This is arguably simpler and better than #20111. Let's see if it passes.

The test runner executes the compiled program in the test process, so
exit stopped the test host. Use an entry point that fails on a wrong
result.
@majocha
majocha marked this pull request as ready for review November 23, 2026 14:16
@majocha
majocha requested a review from a team as a code owner November 23, 2026 14:16
@github-project-automation github-project-automation Bot moved this from New to In Progress in F# Compiler and Tooling Nov 23, 2026
@abonie
abonie merged commit 0f36899 into dotnet:main Nov 23, 2026
55 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in F# Compiler and Tooling Nov 23, 2026
@abonie

abonie commented Nov 24, 2026

Copy link
Copy Markdown
Member

/backport to release/11.0.1xx

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx (link to workflow run)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Usage of an inline operator overload in a member function causes FS1114 with FSC 11

2 participants