aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/t252.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-03-02 22:49:28 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-03-18 11:14:13 +0100
commit6dc3d62d68d7135c055da9589456d27eee89de80 (patch)
tree4459f842ed0bff5e80952db0a60752793662f3b5 /tests/pos/t252.scala
parent6801850859cfdd33431ed63618559a224b1227fb (diff)
downloaddotty-6dc3d62d68d7135c055da9589456d27eee89de80.tar.gz
dotty-6dc3d62d68d7135c055da9589456d27eee89de80.tar.bz2
dotty-6dc3d62d68d7135c055da9589456d27eee89de80.zip
Avoid dependent methods being closures.
We now make sure that a closure's result type does avoid references to parameter types.
Diffstat (limited to 'tests/pos/t252.scala')
-rw-r--r--tests/pos/t252.scala12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/pos/t252.scala b/tests/pos/t252.scala
index d51b5511e..ac4e97106 100644
--- a/tests/pos/t252.scala
+++ b/tests/pos/t252.scala
@@ -11,6 +11,18 @@ abstract class Base {
}
abstract class Derived extends Base {
+
+ val t: T = ???
+
+ // trying a simple dependent closure body first
+ def cont1[X, Y](x: X)(f: X => Y): Y = f(x)
+ cont1(t)(x => x.module)
+
+ // trying an indirectly dependent closure body first
+ def cont2[X, Y](x: X)(f: X => Int => Y): Y = f(x)(1)
+ cont2(t)(x => z => x.module)
+
+ // trying the original, harder case next
def f(inputs: List[tType]): Unit = {
for (t <- inputs; m = t.module) { }
}