diff options
Diffstat (limited to 'test')
4 files changed, 65 insertions, 0 deletions
diff --git a/test/files/run/delambdafy-dependent-on-param-subst-2.scala b/test/files/run/delambdafy-dependent-on-param-subst-2.scala new file mode 100644 index 0000000000..7b6fc597e8 --- /dev/null +++ b/test/files/run/delambdafy-dependent-on-param-subst-2.scala @@ -0,0 +1,20 @@ +trait M[-X] { + def m(x: X): Boolean +} + +class C +class A { class C } + +object Test { + def main(args: Array[String]) { + val a = new A + + // class O extends M[a.C] { def m(x: a.C) = true } + // (new O: M[Null]).m(null) // Okay + + ((a: A) => { + class N extends M[a.C] { def m(x: a.C) = true } + new N: M[Null] + }).apply(a).m(null) // NPE, missing bridge + } +} diff --git a/test/files/run/delambdafy-dependent-on-param-subst.flags b/test/files/run/delambdafy-dependent-on-param-subst.flags new file mode 100644 index 0000000000..2b27e19830 --- /dev/null +++ b/test/files/run/delambdafy-dependent-on-param-subst.flags @@ -0,0 +1 @@ +-Ydelambdafy:method
\ No newline at end of file diff --git a/test/files/run/delambdafy-dependent-on-param-subst.scala b/test/files/run/delambdafy-dependent-on-param-subst.scala new file mode 100644 index 0000000000..7b6fc597e8 --- /dev/null +++ b/test/files/run/delambdafy-dependent-on-param-subst.scala @@ -0,0 +1,20 @@ +trait M[-X] { + def m(x: X): Boolean +} + +class C +class A { class C } + +object Test { + def main(args: Array[String]) { + val a = new A + + // class O extends M[a.C] { def m(x: a.C) = true } + // (new O: M[Null]).m(null) // Okay + + ((a: A) => { + class N extends M[a.C] { def m(x: a.C) = true } + new N: M[Null] + }).apply(a).m(null) // NPE, missing bridge + } +} diff --git a/test/files/run/value-class-partial-func-depmet.scala b/test/files/run/value-class-partial-func-depmet.scala new file mode 100644 index 0000000000..12ff64ed36 --- /dev/null +++ b/test/files/run/value-class-partial-func-depmet.scala @@ -0,0 +1,24 @@ +class C +class A { class C } + +object Test { + def main(args: Array[String]) { + val a = new A + + new VC("").foo(a) + } +} + +class VC(val a: Any) extends AnyVal { + def foo(a: A) = { + val pf: PartialFunction[a.C, Any] = { case x => x } + (pf: PartialFunction[Null, Any]).isDefinedAt(null) + } +} + +// 2.11.0-M6 +// test/files/run/value-class-partial-func-depmet.scala:14: error: overriding method applyOrElse in trait PartialFunction of type [A1 <: a.C, B1 >: Any](x: A1, default: A1 => B1)B1; +// method applyOrElse has incompatible type +// val pf: PartialFunction[a.C, Any] = { case x => x } +// ^ +// one error found |