aboutsummaryrefslogtreecommitdiff
path: root/tests/pickling/nameddefaults.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-03-08 22:02:22 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-03-18 11:16:37 +0100
commit5962a931c83622ce065bc1ce9add049ade89bfcf (patch)
tree24851bbc76f1ca537456715c44a9f866a5c00668 /tests/pickling/nameddefaults.scala
parent19bfc0c6c9be9c4c3fdca55480e01e980a493b42 (diff)
downloaddotty-5962a931c83622ce065bc1ce9add049ade89bfcf.tar.gz
dotty-5962a931c83622ce065bc1ce9add049ade89bfcf.tar.bz2
dotty-5962a931c83622ce065bc1ce9add049ade89bfcf.zip
Pickling test reorg
Move pickling tests into separate top-level test directory. That way they are not needlessly pos-tested before. Also, disable core tests for now - after rebasing we get a stale symbol error. Need to investigate that.
Diffstat (limited to 'tests/pickling/nameddefaults.scala')
-rw-r--r--tests/pickling/nameddefaults.scala63
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/pickling/nameddefaults.scala b/tests/pickling/nameddefaults.scala
new file mode 100644
index 000000000..671f14a07
--- /dev/null
+++ b/tests/pickling/nameddefaults.scala
@@ -0,0 +1,63 @@
+object nameddefaults {
+
+ def foo(first: Int, second: Int = 2, third: Int = 3) = first + second
+
+ var x = 1
+ var y = 2
+
+ foo(1, 2, 3)
+
+ foo(1, 2)
+
+ foo(1)
+
+ // named and missing arguments
+
+ foo(first = 1, second = 3)
+
+ foo(second = 3, first = 1)
+
+ foo(first = 2, third = 3)
+
+ foo(2, third = 3)
+
+ // same but with non-idempotent expressions
+
+ foo(first = x, second = y)
+
+ foo(second = x, first = y)
+
+ foo(first = x, third = y)
+
+ foo(x, third = y)
+
+// The same thing, but for classes
+
+ class C(first: Int, second: Int = 2, third: Int = 3) {}
+
+ new C(1, 2, 3)
+
+ new C(1, 2)
+
+ new C(1)
+
+ // named and missing arguments
+
+ new C(first = 1, second = 3)
+
+ new C(second = 3, first = 1)
+
+ new C(first = 2, third = 3)
+
+ new C(2, third = 3)
+
+ // same but with non-idempotent expressions
+
+ new C(first = x, second = y)
+
+ new C(second = x, first = y)
+
+ new C(first = x, third = y)
+
+
+}