C# collection expression support for F# lists & sets
Description
- Add support for creating F# lists & sets in C# using C# 12 collection expressions.
- [x] Language suggestion: https://github.com/fsharp/fslang-suggestions/issues/1355
- [x] RFC: https://github.com/fsharp/fslang-design/pull/776
- [x] RFC discussion: https://github.com/fsharp/fslang-design/discussions/777
Examples
FSharpSet<int> xs = [1, 2, 3];
FSharpList<int> ys = [1, 2, 3];
Checklist
- [x] Test cases added.
- [x] Release notes entry updated.
:heavy_exclamation_mark: Release notes required
:white_check_mark: Found changes and release notes in following paths:
Change path Release notes path Description src/FSharp.Coredocs/release-notes/.FSharp.Core/9.0.100.md
Does anyone know what needs to be done with the new C# test project I added to make the CI happy? Something about the test results needing to be in a certain place, and/or packaging/PDBs?
- https://github.com/dotnet/fsharp/pull/17359/checks?check_run_id=26811754428
- https://dev.azure.com/dnceng-public/public/_build/results?buildId=724144&view=results
*Edit*: Maybe I can figure it out
Forgive me if I'm being obtuse, but I don't think I understand the cause of this error in the CI:
PDB0021: Document name doesn't match any pattern in Source Link: '/_1/microsoft.net.test.sdk/17.4.0/build/netcoreapp3.1/Microsoft.NET.Test.Sdk.Program.cs'
The only results on Google are https://github.com/dotnet/runtime/issues/62892 and https://github.com/dotnet/machinelearning/issues/4400, which don't help me much, since I don't understand the underlying problem.
I can see that it comes from here, but... I do not understand why this PR is triggering that.
Is there something obvious I'm missing?
Failed to run : https://github.com/dotnet/fsharp/actions/runs/9718927879
Do they need to be part of new project? We successfully test interop in component tests.
Do they need to be part of new project? We successfully test interop in component tests.
Hmm, I guess they could technically go there, although these are specifically meant to test the C# compiler's handling of types from FSharp.Core and have nothing to do with the F# compiler per se.
@vzarytovskii
Do they need to be part of new project? We successfully test interop in component tests.
If we want to put these tests in FSharp.Compiler.ComponentTests/Interop (or, perhaps better, FSharp.Core.UnitTests/Interop), we need to update $(RoslynVersion) to a version that includes C# 12 support:
https://github.com/dotnet/fsharp/blob/5c6d8e705a4152ca2711ba57e58850fc561eafea/eng/Versions.props#L92
The version in main (4.6.0-3.23329.3) is a year old. What are the other implications of updating it?
Separately, while it would be nicer from the test writer's perspective to test the consumption of FSharp.Core constructs in C# in an actual C# project, I guess it would have the downside of making it harder to run specific tests against specific versions of C#.
@/vzarytovskii
Do they need to be part of new project? We successfully test interop in component tests.
If we want to put these tests in FSharp.Compiler.ComponentTests/Interop (or, perhaps better, FSharp.Core.UnitTests/Interop), we need to update
$(RoslynVersion)to a version that includes C# 12 support:https://github.com/dotnet/fsharp/blob/5c6d8e705a4152ca2711ba57e58850fc561eafea/eng/Versions.props#L92
The version in
main(4.6.0-3.23329.3) is a year old. What are the other implications of updating it?Separately, while it would be nicer from the test writer's perspective to test the consumption of FSharp.Core constructs in C# in an actual C# project, I guess it would have the downside of making it harder to run specific tests against specific versions of C#.
The Roslyn deps were updated in #17144, merged to main today in #17380. I'll try to get these tests to work now.
[!CAUTION] Repository is on lockdown for maintenance, all merges are on hold.