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

No error for ambiguous overloads when the ambiguity involves a default parameter #7856

Closed
scabug opened this issue Sep 18, 2013 · 3 comments
Closed
Assignees

Comments

@scabug
Copy link

scabug commented Sep 18, 2013

{code}object test {
def foo(a: Int) = 0;
def foo(a: Int, b: Int = 0) = 1
}
defined module test
test.foo(0)
res0: Int = 0{code}

This should provide an error, because the choice of which overload to call is ambiguous.

@scabug
Copy link
Author

scabug commented Sep 18, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7856?orig=1
Reporter: Shelby Moore III (shelby)

@scabug
Copy link
Author

scabug commented Sep 18, 2013

@paulp said:
This is as specified. "In a method application expression, when multiple overloaded alternatives are applicable, the alternative which use default arguments is never selected."

@scabug scabug closed this as completed Sep 18, 2013
@scabug
Copy link
Author

scabug commented Sep 20, 2013

Shelby Moore III (shelby) said (edited on Sep 20, 2013 2:56:58 PM UTC):
Then the specification has a bug.

How can I trust a compiler that allows me to call ambiguous overloads.

Tsk. Tsk.

https://groups.google.com/forum/#!topic/scala-debate/m6QuiSUP43A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants