summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/bug874.check2
-rw-r--r--test/files/run/bug874.scala17
-rw-r--r--test/files/run/records.scala27
3 files changed, 46 insertions, 0 deletions
diff --git a/test/files/run/bug874.check b/test/files/run/bug874.check
new file mode 100644
index 0000000000..91de7e0a03
--- /dev/null
+++ b/test/files/run/bug874.check
@@ -0,0 +1,2 @@
+U created with xyz and 2
+U created with abc and 1
diff --git a/test/files/run/bug874.scala b/test/files/run/bug874.scala
new file mode 100644
index 0000000000..d83014651b
--- /dev/null
+++ b/test/files/run/bug874.scala
@@ -0,0 +1,17 @@
+object Test {
+ abstract class Base {
+ val U: {
+ def apply[A](x1: A)(x2: Int): Any
+ }
+ U("xyz")(2)
+ }
+ class Mix extends Base {
+ case class U[A](x1: A)(x2: Int) {
+ Console.println("U created with "+x1+" and "+x2)
+ }
+ }
+ def main(args : Array[String]) : Unit = {
+ val obvious: Base = new Mix;
+ obvious.U("abc")(1)
+ }
+}
diff --git a/test/files/run/records.scala b/test/files/run/records.scala
new file mode 100644
index 0000000000..c1dc7b67e8
--- /dev/null
+++ b/test/files/run/records.scala
@@ -0,0 +1,27 @@
+trait C {
+ def f: Int
+}
+
+object Test {
+ type T = C {
+ def f: Int
+ def g: String
+ }
+
+ val x: T = new C {
+ def f = 1
+ def g = "hello"
+ }
+
+ val y = new C {
+ def f = 2
+ def g = " world"
+ }
+
+ val z: T = y
+
+ def main(args: Array[String]): Unit = {
+ assert(x.f+z.f == 3)
+ assert(x.g+z.g == "hello world")
+ }
+}