Uh oh!
There was an error while loading. Please reload this page.
Test debug-inline capture of a local function from a nested closure - #20299
Test debug-inline capture of a local function from a nested closure#20299T-Gro wants to merge 3 commits into
Conversation
…callsite Regression coverage for #20297. The reduced repro keeps the reported shape - a captured local function, a callsite inside a nested closure, and '>>' composition - and crashes with AccessViolationException on release/10.0.4xx, where <addEnum>__debug@N is emitted as a two-argument static method that does 'ldarg.0; ldfld tee' against the string parameter. It passes once #20089 is present. SRTP 30-38 all call the inline function directly from the enclosing method, so none of them cover a callsite inside a closure. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
| let f () = | ||
| let tee g (x: int) = g x; x | ||
| let addName (key: string) (v: string) = tee (fun x -> printfn "%s=%s" key v) | ||
| let inline addEnum (key: string) value = tee (fun x -> printfn "%s=%d" key (x + int value)) | ||
| let pipeline v = addName "a" "n" >> addEnum "b" v | ||
| pipeline 1uy 41 |
There was a problem hiding this comment.
I'd personally try to minimize the test, so the dumps are easier to follow if needed, but otherwise it's fine.
There was a problem hiding this comment.
Minimized the repro in ac6ae82: dropped the printfn formatting and the extra addName closure, keeping only the essential ingredients (inline function whose body is a lambda capturing the outer local tee, used first-class inside the >> nested closure) plus the int value/ExplicitDynamic SRTP aspect. The baseline is now 108 lines (was 166) and still shows <addEnum>__debug@5 receiving the captured tee through a closure field.
Address review feedback: strip printfn and addName noise from the repro so the emitted-IL baseline is easier to follow. The minimized source keeps all essential ingredients (inline function whose body is a lambda capturing an outer local 'tee', used first-class inside a nested closure via >>) and the SRTP 'int value'/ExplicitDynamic aspect, so <addEnum>__debug@N still reaches the captured local through a closure field. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…-inline-captured-locals-t
Regression test only — #20297 is already fixed on
mainby #20089.Existing coverage applies the
inlinefunction directly from the enclosing method. This test applies it inside a nested closure, so the captured local reaches the synthesized<name>__debug@Nmethod through a closure field. Before #20089 that emittedldarg.0; ldfldagainst astringparameter and crashed withAccessViolationException.release/10.0.4xx(SDK 10.0.400) has #19548 but not #20089, and is still affected.