diff options
author | odersky <odersky@gmail.com> | 2017-03-14 17:05:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-14 17:05:30 +0100 |
commit | 934da77590dad2003fe850b48b2ae01b427508f0 (patch) | |
tree | 42ded3e03ed2c16e1680ebaf72a49ad2964b2026 /tests | |
parent | 1aad0a1433e1261af252d2240d63f6f01da65cef (diff) | |
parent | 3c22580feccca384e83465afd38d3df689c61f88 (diff) | |
download | dotty-934da77590dad2003fe850b48b2ae01b427508f0.tar.gz dotty-934da77590dad2003fe850b48b2ae01b427508f0.tar.bz2 dotty-934da77590dad2003fe850b48b2ae01b427508f0.zip |
Merge pull request #2079 from dotty-staging/depmeth2
Allow inter-parameter dependencies
Diffstat (limited to 'tests')
-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" + +} |