summaryrefslogtreecommitdiff
path: root/test/pending/run
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-02-23 17:13:37 +0000
committerMartin Odersky <odersky@gmail.com>2007-02-23 17:13:37 +0000
commitfca1d7499a02cee13c6845cb3cffe77c8dc73231 (patch)
treea517da50092dc38243b1653810267d7a9808cd23 /test/pending/run
parentb4a6ccf03370c8ea5b1ce8fdf26f9219f2040e47 (diff)
downloadscala-fca1d7499a02cee13c6845cb3cffe77c8dc73231.tar.gz
scala-fca1d7499a02cee13c6845cb3cffe77c8dc73231.tar.bz2
scala-fca1d7499a02cee13c6845cb3cffe77c8dc73231.zip
prepared the ground for duck typing.
Diffstat (limited to 'test/pending/run')
-rw-r--r--test/pending/run/records.scala25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/pending/run/records.scala b/test/pending/run/records.scala
new file mode 100644
index 0000000000..87b15265f2
--- /dev/null
+++ b/test/pending/run/records.scala
@@ -0,0 +1,25 @@
+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
+
+ Console.println(x.f+z.f+", expected = 3")
+ Console.println(x.g+z.g+", expected = hello world")
+}