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

Support consuming IL(C#)-defined generic T with AllowByRefLike anti-constraint #17597

Merged
merged 14 commits into from
Sep 3, 2024

Conversation

T-Gro
Copy link
Member

@T-Gro T-Gro commented Aug 23, 2024

@T-Gro T-Gro linked an issue Aug 23, 2024 that may be closed by this pull request
Copy link
Contributor

github-actions bot commented Aug 23, 2024

❗ Release notes required


✅ Found changes and release notes in following paths:

Warning

No PR link found in some release notes, please consider adding it.

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/9.0.100.md No current pull request URL (#17597) found, please consider adding it

@T-Gro T-Gro marked this pull request as ready for review August 26, 2024 14:33
@T-Gro T-Gro requested a review from a team as a code owner August 26, 2024 14:33
@T-Gro T-Gro changed the title [WIP to get errors] Support consuming IL(C#)-defined generic T with AllowByRefLike anti-constraint Support consuming IL(C#)-defined generic T with AllowByRefLike anti-constraint Aug 26, 2024
@vzarytovskii
Copy link
Member

Shall we add tests for builders? Classic and resumable? Since a bunch of continuations are getting codegened there as well as inlining and state machines.

@T-Gro
Copy link
Member Author

T-Gro commented Aug 30, 2024

Shall we add tests for builders? Classic and resumable? Since a bunch of continuations are getting codegened there as well as inlining and state machines.

We don't propagate that generic anti-constraint to F# code, it really is only allowed for an ILCall expression.
Any specific idea in mind?

You mean like a generic builder, where the typar instantion would be e.g. MyBuilder<IEnumrable<Span<byte>>> ?
Or using a them inside a CE ?

@T-Gro
Copy link
Member Author

T-Gro commented Aug 30, 2024

I am thinking of some sensible real-world-like usecase involving a builder.
If anyone has an idea, I can definitely put it together as a test case (in this case, one we would fully run and let verify via the runtime)

@vzarytovskii
Copy link
Member

vzarytovskii commented Aug 30, 2024

Or using a them inside a CE ?

Mostly this, generic builders are less of a concern, I think.

I am thinking of some sensible real-world-like usecase involving a builder. If anyone has an idea, I can definitely put it together as a test case (in this case, one we would fully run and let verify via the runtime)

For example, if we have a collection builder and we define a bind or yieldfrom for some source with the type of (source: seq<ReadOnlySpan<int>>). I wonder what would we codegen in this case.

@T-Gro T-Gro merged commit bb027e1 into main Sep 3, 2024
30 checks passed
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.

Support ref structs in generics
3 participants