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

Positional argument should be allowed after named argument that is in its original position #2488

Closed
scabug opened this issue Oct 19, 2009 · 6 comments

Comments

@scabug
Copy link

scabug commented Oct 19, 2009

The following code ought to compile.

def f(a: int, b: Int) = 0
f(a = 4, 5)
@scabug
Copy link
Author

scabug commented Oct 19, 2009

Imported From: https://issues.scala-lang.org/browse/SI-2488?orig=1
Reporter: @dubochet

@scabug
Copy link
Author

scabug commented Oct 19, 2009

@gaydenko said:
From my ordinary Scala user's POV additional degree of freedom just complicate the code. For named arguments "all or nothing" rule seem more acceptable, IMHO.

@scabug
Copy link
Author

scabug commented Nov 12, 2009

@lrytz said:
fixed in r19546

@scabug
Copy link
Author

scabug commented Apr 22, 2011

@retronym said:
The spec was not updated to reflect this change.

@scabug
Copy link
Author

scabug commented Dec 3, 2011

@OlegYch said (edited on Dec 3, 2011 6:40:34 PM UTC):
looks like the issue requires a bit more attention
it still doesn't compile in case of several overloads and error message is really misleading:

class c {def f(a:Int, b:Int) = 1; def f() = 1}
new c().f(a=1,2)

fails with

<console>:18: error: overloaded method value f with alternatives:
  ()Int <and>
  (a: Int,b: Int)Int
 cannot be applied to (a: Int, Int)
              new c().f(a=1,2)

tested with 2.8.0, 2.9.1 and scala-2.10.0.r25912-b20111031024940

@scabug
Copy link
Author

scabug commented May 19, 2012

@lrytz said:
fixed in [https://github.com/scala/scala/commit/da994bc9ce2cd9394ccb994fad677a6c67ad2759]

spec fixed in [https://github.com/scala/scala-dist/commit/5b2fa4e3ca6c9ed27f6946934a03a1b1afbecf5d]

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

No branches or pull requests

2 participants