Skip to content

Optimizer: fix accessing captured values when skipping inlining - #20089

Open
auduchinok wants to merge 1 commit into
dotnet:mainfrom
auduchinok:optimizer-noInline-accessCaptured
Open

Optimizer: fix accessing captured values when skipping inlining#20089
auduchinok wants to merge 1 commit into
dotnet:mainfrom
auduchinok:optimizer-noInline-accessCaptured

Conversation

@auduchinok

@auduchinok auduchinok commented Jul 28, 2026

Copy link
Copy Markdown
Member

Fixes the captured values repro from #20063.

let f () =
    let x = 42
    let inline g y = x + int y
    g 1uy

printfn "%A (expected 43)" (f ())
let f2 () =
    let xs = [ 1; 2; 3 ]
    let inline g y = xs |> List.map (fun v -> v + int y) |> List.sum
    g 1uy

printfn "%A (expected 9)" (f2 ())

@auduchinok
auduchinok requested a review from a team as a code owner July 28, 2026 14:43
@auduchinok auduchinok added the NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes label Jul 28, 2026
@github-actions github-actions Bot added AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files ⚠️ Affects-Compiler-Output Tooling check: PR touches IL emission or codegen labels Jul 28, 2026
@github-actions

This comment has been minimized.

--------------------------------------------------------------------------------

Test::f
(3,5-3,15) let x = 42

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.

The actual source code triggered from test starts with a leading newline, so the index 3 here actually points to the 2nd line in this .bsl file header. Took me a while to mentally navigate from the indexes to code with this deviation.

@github-project-automation github-project-automation Bot moved this from New to In Progress in F# Compiler and Tooling Aug 3, 2026
@T-Gro
T-Gro enabled auto-merge (squash) August 3, 2026 19:10
auto-merge was automatically disabled August 10, 2026 10:12

Head branch was pushed to by a user without write access

@auduchinok
auduchinok force-pushed the optimizer-noInline-accessCaptured branch from 6f53591 to ae4fe1b Compare August 10, 2026 10:12
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Release notes required, but author opted out

Warning

Author opted out of release notes, check is disabled for this pull request.
cc @dotnet/fsharp-team-msft

@auduchinok

Copy link
Copy Markdown
Member Author

This is ready.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Tooling Safety Check — Affects-Compiler-Output
Affects-Compiler-Output: modifies Optimizer.fs (IL output)

Generated by PR Tooling Safety Check · opus46 5.7M ·

@auduchinok auduchinok closed this Aug 10, 2026
@auduchinok auduchinok reopened this Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚠️ Affects-Compiler-Output Tooling check: PR touches IL emission or codegen AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants