Skip to content

[All] Add support for [<InlineIfLambda>]#4401

Merged
MangelMaxime merged 2 commits intomainfrom
fix-inline-if-lambda
Mar 20, 2026
Merged

[All] Add support for [<InlineIfLambda>]#4401
MangelMaxime merged 2 commits intomainfrom
fix-inline-if-lambda

Conversation

@MangelMaxime
Copy link
Member

This PR add support for [<InlineIfLambda>]

  1. I needed to store some more information on Fable.AST (once more 🙈)
  2. We need to do the resolution ourself for retrieving the lambda body hopefully I covered the most common cases if not all.

Documentation about this feature is sparse

  1. I add tests for Python, Dart, Rust and JavaScript to make sure I am not breaking the code at runtime
  2. But the real tests for this features are under the integration project, because it allows us to validate the generated source code and not the runtime behaviour

@MangelMaxime MangelMaxime requested review from dbrattli and ncave March 14, 2026 18:23
@github-actions
Copy link
Contributor

Python Type Checking Results (Pyright)

Metric Value
Total errors 18
Files with errors 4
Excluded files 4
New errors ✅ No
Excluded files with errors (4 files)

These files have known type errors and are excluded from CI. Remove from pyrightconfig.ci.json as errors are fixed.

File Errors Status
temp/tests/Python/test_applicative.py 12 Excluded
temp/tests/Python/test_hash_set.py 3 Excluded
temp/tests/Python/test_nested_and_recursive_pattern.py 2 Excluded
temp/tests/Python/fable_modules/thoth_json_python/encode.py 1 Excluded

@MangelMaxime
Copy link
Member Author

I believe the CI for JavaScript broke because the changes made to Fable.AST are not backward compatible.

@MangelMaxime MangelMaxime force-pushed the fix-inline-if-lambda branch from eeda534 to fccf456 Compare March 20, 2026 10:17
@MangelMaxime MangelMaxime merged commit 6f95d41 into main Mar 20, 2026
22 of 24 checks passed
@MangelMaxime MangelMaxime deleted the fix-inline-if-lambda branch March 20, 2026 10:40
@MangelMaxime
Copy link
Member Author

Hello,

@Lanayx @shayanhabibi

With the release of Fable 5.0.0-rc.4 and more importantly Fable.AST 5.0.0-rc.3.

It is possible that you need to update your Fable plugin packages before we broke the binary compatibility.

@Lanayx
Copy link
Contributor

Lanayx commented Mar 20, 2026

@MangelMaxime Few changes were needed, but everything seems to work fine after updates. Just wonder - do plugins still have to live on .NET 6? I've tried moving to .NET 8, but it didn't work.

@MangelMaxime
Copy link
Member Author

I don't see us forcing .NET 6.0 anywhere.

Looking more into the error:

Parsing HelloWorld.fsproj...
Couldn't build Oxpecker.Solid.FablePlugin: The index is outside the legal range.
count = 1, array.Length = 0 (Parameter 'count')
Couldn't build Oxpecker.Solid.FablePlugin: The index is outside the legal range.
count = 1, array.Length = 0 (Parameter 'count')
Project and references (9 source files) parsed in 2332ms

I have a feeling that something is broken in

member _.BuildDll(normalizedDllPath: string) =
if not (builtDlls.Contains(normalizedDllPath)) then
let projDir =
normalizedDllPath.Split('/')
|> Array.rev
|> Array.skipWhile (fun part -> part <> "bin")
|> Array.skip 1
|> Array.rev
|> String.concat "/"
let stdout =
Process.runSyncWithOutput projDir "dotnet" [ "build"; "-c"; cliArgs.Configuration ]
Log.always stdout
builtDlls.Add(normalizedDllPath) |> ignore

I am trying to take a look at it

@MangelMaxime
Copy link
Member Author

Ok, I found the issue:

/main/src/Oxpecker.Solid.FablePlugin/bin/Release/net6.0/Oxpecker.Solid.FablePlugin.dll

/main/src/Oxpecker.Solid.FablePlugin/obj/Release/net8.0/ref/Oxpecker.Solid.FablePlugin.dll

For some reason the path is different 😓

@MangelMaxime
Copy link
Member Author

Ok, I have a working version locally.

I will see to do some cleanup and merge the code during the weekend.

@MangelMaxime
Copy link
Member Author

@Lanayx

This will be fixed in the next release

@Lanayx
Copy link
Contributor

Lanayx commented Mar 21, 2026

Thank you!

@Lanayx
Copy link
Contributor

Lanayx commented Mar 22, 2026

@MangelMaxime Actually, when doing the change, I've noticed that genericArgs were changed to genericArg for tuple. I first thought that this is expected, but now I think that it isn't, so might be better fixed before stable release. (see update needed here)
The change was a result of those commits
image

@ncave
Copy link
Collaborator

ncave commented Mar 22, 2026

@Lanayx You are correct, this was an unintentional typo. Fixed in #4436.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants