Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C# collection expression support for F# lists & sets #17359

Merged

Conversation

brianrourkeboll
Copy link
Contributor

@brianrourkeboll brianrourkeboll commented Jun 27, 2024

Description

Examples

FSharpSet<int> xs = [1, 2, 3];
FSharpList<int> ys = [1, 2, 3];

Checklist

  • Test cases added.
  • Release notes entry updated.

Copy link
Contributor

github-actions bot commented Jun 27, 2024

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/FSharp.Core docs/release-notes/.FSharp.Core/9.0.100.md

* The `EditorBrowsable` attribute on the `ScopedRefAttribute` definition
  only exists on the BCL implementation because the `scope` keyword is
  meant to be used in C# instead of this attribute. Since F# doesn't
  have the `scoped` keyword, this reasoning doesn't apply.
@brianrourkeboll brianrourkeboll changed the title C# collection expression support for lists & sets C# collection expression support for F# lists & sets Jun 27, 2024
Copy link
Member

@KevinRansom KevinRansom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice, thanks for this. It's nice to be able to improve C# F# interop.

src/FSharp.Core/prim-types.fs Outdated Show resolved Hide resolved
src/FSharp.Core/prim-types.fsi Outdated Show resolved Hide resolved
@brianrourkeboll
Copy link
Contributor Author

brianrourkeboll commented Jun 28, 2024

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?

*Edit*: Maybe I can figure it out

image

@brianrourkeboll
Copy link
Contributor Author

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 dotnet/runtime#62892 and dotnet/machinelearning#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?

Copy link
Contributor

@brianrourkeboll brianrourkeboll force-pushed the csharp-collection-expression-support branch from 67457e9 to 44e0dcd Compare June 29, 2024 18:39
@vzarytovskii
Copy link
Member

Do they need to be part of new project? We successfully test interop in component tests.

@brianrourkeboll
Copy link
Contributor Author

brianrourkeboll commented Jun 29, 2024

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.

@brianrourkeboll
Copy link
Contributor Author

@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:

<RoslynVersion>4.6.0-3.23329.3</RoslynVersion>

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#.

@brianrourkeboll
Copy link
Contributor Author

@/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:

<RoslynVersion>4.6.0-3.23329.3</RoslynVersion>

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.

Copy link
Contributor

github-actions bot commented Jul 8, 2024

Caution

Repository is on lockdown for maintenance, all merges are on hold.

@brianrourkeboll brianrourkeboll marked this pull request as ready for review July 8, 2024 18:02
@brianrourkeboll brianrourkeboll requested a review from a team as a code owner July 8, 2024 18:02
Copy link
Contributor

@edgarfgp edgarfgp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Brian

Copy link
Member

@vzarytovskii vzarytovskii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I'm happy to merge it.

Copy link
Member

@psfinaki psfinaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, as usual. Thanks!

@vzarytovskii vzarytovskii merged commit 3125875 into dotnet:main Jul 16, 2024
29 of 30 checks passed
@brianrourkeboll brianrourkeboll deleted the csharp-collection-expression-support branch July 16, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

6 participants