We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a2e9039 commit 27c7538Copy full SHA for 27c7538
tests/neg/creator-ambiguous.scala
@@ -0,0 +1,23 @@
1
+
2
+// This used to succeed with old creator methods scheme
3
+// What happened was: the overloading resolution gave an ambiguous
4
+// overload, but then the falblback picked the constructor
5
+object Test:
6
7
+ case class Record(elems: (String, Any)*)
8
9
+ object Record:
10
11
+ inline def apply[R <: Record](elems: (String, Any)*) : R = new Record(elems: _*).asInstanceOf[R]
12
13
+ def fromUntypedTuple(elems: (String, Any)*): Record = Record(elems: _*) // error: ambiguous overload
14
15
+ def apply(x: String): Test = Test(x ++ x)
16
17
+ def apply(x: Integer): Test = Test(x + x)
18
19
+ Test(null) // error: ambiguous overload
20
21
+end Test
22
23
+class Test(x: Object)
0 commit comments