From a200695677237922fdf6f995c690cb0108ec2fc4 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 11 Jul 2016 14:02:38 +0200 Subject: Fix SI-2712 Allows partially instantiated types as type constrictors when inferring higher-kinded types. --- tests/neg/i94-nada.scala | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/neg/i94-nada.scala (limited to 'tests/neg') diff --git a/tests/neg/i94-nada.scala b/tests/neg/i94-nada.scala new file mode 100644 index 000000000..8ca104e06 --- /dev/null +++ b/tests/neg/i94-nada.scala @@ -0,0 +1,11 @@ +trait Test1 { + trait Monad[MX] { + def x: MX + } + sealed abstract class Either[A,B] + case class Left[A,B](x: A) extends Either[A,B] with Monad[A] + case class Right[A,B](x: B) extends Either[A,B] with Monad[B] + def flatMap[FX,FY,M[FMX]<:Monad[FMX]](m: M[FX], f: FX => M[FY]): M[FY] = f(m.x) + println(flatMap(Left(1), {x: Int => Left(x)})) // error: Left does not conform to [X] -> Monad[X] + +} -- cgit v1.2.3