diff options
-rw-r--r-- | tests/neg/illegal-depmeth.scala | 13 | ||||
-rw-r--r-- | tests/pos/param-depmeth.scala | 15 |
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/neg/illegal-depmeth.scala b/tests/neg/illegal-depmeth.scala new file mode 100644 index 000000000..e4d771a07 --- /dev/null +++ b/tests/neg/illegal-depmeth.scala @@ -0,0 +1,13 @@ +object Test { + + class C { type T } + + def f(x: C, y: x.T): x.T = y // ok + + def g(y: x.T, x: C): x.T = y // error + + def h(x: x.T) = ??? // error + + def g(x: => C): x.T = ??? // error: x is not stable + +} diff --git a/tests/pos/param-depmeth.scala b/tests/pos/param-depmeth.scala new file mode 100644 index 000000000..2e887d181 --- /dev/null +++ b/tests/pos/param-depmeth.scala @@ -0,0 +1,15 @@ +object Test { + + class C { type T } + + def f(x: C, y: x.T): x.T = y // ok + + val c = new C { type T = String } + val c2 = c + + f(c, "abc") + f(new C{ type T = String}, "abc") + + val d: (C{ type T = String}) # T = "abc" + +} |