This repository was archived by the owner on Sep 1, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +60
-1
lines changed
src/compiler/scala/tools/nsc/typechecker Expand file tree Collapse file tree 5 files changed +60
-1
lines changed Original file line number Diff line number Diff line change @@ -617,7 +617,8 @@ trait Infer {
617
617
} else if (argPos.contains(pos)) { // parameter specified twice
618
618
namesOK = false
619
619
} else {
620
- positionalAllowed = false
620
+ if (index != pos)
621
+ positionalAllowed = false
621
622
argPos(index) = pos
622
623
}
623
624
index += 1
Original file line number Diff line number Diff line change
1
+ t2488.scala:7: error: overloaded method value f with alternatives:
2
+ ()Int <and>
3
+ (a: Int,b: Int)Int
4
+ cannot be applied to (b: Int, Int)
5
+ println(c.f(b = 2, 2))
6
+ ^
7
+ t2488.scala:8: error: overloaded method value f with alternatives:
8
+ ()Int <and>
9
+ (a: Int,b: Int)Int
10
+ cannot be applied to (a: Int, c: Int)
11
+ println(c.f(a = 2, c = 2))
12
+ ^
13
+ t2488.scala:9: error: overloaded method value f with alternatives:
14
+ ()Int <and>
15
+ (a: Int,b: Int)Int
16
+ cannot be applied to (Int, c: Int)
17
+ println(c.f(2, c = 2))
18
+ ^
19
+ t2488.scala:10: error: overloaded method value f with alternatives:
20
+ ()Int <and>
21
+ (a: Int,b: Int)Int
22
+ cannot be applied to (c: Int, Int)
23
+ println(c.f(c = 2, 2))
24
+ ^
25
+ t2488.scala:11: error: overloaded method value f with alternatives:
26
+ ()Int <and>
27
+ (a: Int,b: Int)Int
28
+ cannot be applied to (Int)
29
+ println(c.f(2))
30
+ ^
31
+ 5 errors found
Original file line number Diff line number Diff line change
1
+ class C {
2
+ def f (a: Int , b: Int ) = 1
3
+ def f () = 2
4
+ }
5
+ object Test extends App {
6
+ val c = new C ()
7
+ println(c.f(b = 2 , 2 ))
8
+ println(c.f(a = 2 , c = 2 ))
9
+ println(c.f(2 , c = 2 ))
10
+ println(c.f(c = 2 , 2 ))
11
+ println(c.f(2 ))
12
+ }
Original file line number Diff line number Diff line change
1
+ 1
2
+ 1
3
+ 1
4
+ 2
Original file line number Diff line number Diff line change
1
+ class C {
2
+ def f (a: Int , b: Int ) = 1
3
+ def f () = 2
4
+ }
5
+ object Test extends App {
6
+ val c = new C ()
7
+ println(c.f(a = 1 ,2 ))
8
+ println(c.f(a = 1 , b = 2 ))
9
+ println(c.f(b = 2 , a = 1 ))
10
+ println(c.f())
11
+ }
You can’t perform that action at this time.
0 commit comments