-
Notifications
You must be signed in to change notification settings - Fork 89
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 can not resolve overloads of method when it has tupple argument #450
Comments
Try without parentehsis: | a2 is B => FT(a2, s) |
It's workaround. And it does work only when method has one tupple argument. It does not work for methods with two and more tupple arguments class A { }
class B : A { }
class D : A { }
class C
{
F(a1 : A, a2 : A) : void
{
| (a11 is B, a21 is B) => F(a11, a21); // here is OK
}
F(_ : B, _ : B) : void {}
FT(a1 : A * string, a2 : A * string) : void
{
def (a11, s1) = a1;
def (a21, s2) = a2;
match(a11, a21)
{
| (a31 is B, a32 is B) => FT((a31, s1), (a32, s2)); // but here is error : typing fails on ambiguity between overloads
| (a31 is D, a32 is D) => FT(a31, s1, a32, s2); // here is error : wrong number of parameters in call, needed 2, got 4
| _ => {}
}
}
FT(_ : B * string, _ : B * string) : void {}
FT(_ : D * string, _ : D * string) : void {}
} |
Seems like bug in Typer. match((a11, a21))
{
| (a31 is B, a32 is B) => FT((a31, s1) : B * _, (a32, s2)); |
Thank you for your advise. |
Code below has simple class hierarchy A <- B. There are two overloads of method F - F(A) and F(B), also there are two overloads of FT - FT(A * string) and FT(B * string).
In method F(A) compiler correctly resolves between F(A) and F(B). But when method has tupple argument compiler generates error. In method FT(A * string) compiler can not resolve between FT(A * string) and FT(B * string) though argument has type B * string.
Nemerle 1.1.1004.0 (setup from NemerleSetup-net-4.5-v1.1.1004.0-nightly.msi)
Visual Studio 2010
x64 OS
The text was updated successfully, but these errors were encountered: