From 6dc3d62d68d7135c055da9589456d27eee89de80 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 2 Mar 2015 22:49:28 +0100 Subject: Avoid dependent methods being closures. We now make sure that a closure's result type does avoid references to parameter types. --- tests/pos/t252.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/pos/t252.scala') 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) { } } -- cgit v1.2.3