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

Compiler incompatible: F# in .NET 9 produces an error FS0192 when working with C#' s duplicated method names #17950

Closed
ruxo opened this issue Nov 3, 2024 · 2 comments

Comments

@ruxo
Copy link

ruxo commented Nov 3, 2024

I have a library with a validation class look like this:

public static class Migration
{
    public sealed class Validation
    {
        public static Validation Requires(params string[] names) => new(names);
        public static Validation Requires(IEnumerable<string> names) => new(names.AsArray());

        public static Validation Requires<T>(string[]? excepts = null) {
            // omitted
        }
     // snipped
     }
}

and I have an F# project for testing and referring to the Requires method.

type TestMigration() =
    interface IMigration with
        member this.Version = Version(0,0,1)
        member this.Name = "Test migration"
        member this.Up db =
            let name = FSharp.ToExpression<Customer, obj>(_.Name)
            db.Build<Customer>()
              .WithSchema(Migration.Validation.Requires<Customer>())   // refer here
              .Index("Name", fun b -> b.Ascending(name))
              .Run()
        member this.Down db =
            db.DropCollection(nameof Customer)

With .NET 8 (SDK 8.0.306), it was compiled without any issues. But with .NET 9 (9.0.100-rc.2.24474.11), it causes an error when compiled.

error FS0192: Error  internal: multiple methods named Requires appear with identical argument types in type Validation

It seems like the type parameter is ignored?

@edgarfgp
Copy link
Contributor

edgarfgp commented Nov 3, 2024

Similar to #17796. Which has been already fixed. I guess will be available in the official release

@T-Gro
Copy link
Member

T-Gro commented Nov 7, 2024

Yes, the issue has been addressed.

It appears when consumed methods have overloads, which have exact arguments, and ONLY differ in the amount of generic type arguments.

@T-Gro T-Gro closed this as completed Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants