Delegates aren't getting inlined in certain cases, when using InlineIfLambda
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 144
Description
`SystemAction` below is not getting inlined, as it used to prior .NET7p5
```fsharp
namespace FSharpConsole
module Foo =
open System
type SystemAction<'a
when 'a: struct and 'a :> IConvertible>
= delegate of byref<'a> -> unit
let inline doAction (span: Span<'a>) ([] action: SystemAction<'a>) =
for i = 0 to span.Length - 1 do
let batch = &span[i]
action.Invoke &batch
[]
let main args =
let array = Array.zeroCreate 100
doAction (array.AsSpan()) (SystemAction(fun batch-> batch <- batch + 1))
0
```
Last compiler where it worked - .NET7 p4 = 8854f5d1 https://github.com/dotnet/fsharp/commit/8854f5d1
Last compiler where it broke - .NET7p5 = a4208e91 https://github.com/dotnet/fsharp/commit/a4208e91
Diff - https://github.com/dotnet/fsharp/compare/8854f5d1..a4208e91
Commits - https://github.com/dotnet/fsharp/compare/8854f5d1...a4208e91
Likely suspect - https://github.com/dotnet/fsharp/commit/1b39cdea4d85bb63c2e919dbb21e87686c1d2be1
Contributor guide
Assessment
This issue has not been assessed yet.