summaryrefslogtreecommitdiff
path: root/test/files/run/records.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/records.scala')
-rw-r--r--test/files/run/records.scala27
1 files changed, 27 insertions, 0 deletions
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")
+ }
+}