From c408f6f25cab0d8b352d8fcc1e31f26ab0435a78 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 20 Jul 2017 11:04:06 +0200 Subject: [PATCH 1/2] Fix confusion between AppliedTypeTree and TypeApply inferTypeParams should have generated an AppliedTypeTree, but it did generate a TypeApply instead. --- compiler/src/dotty/tools/dotc/typer/Inferencing.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/typer/Inferencing.scala b/compiler/src/dotty/tools/dotc/typer/Inferencing.scala index eabd72e434dc..b2c8fd0595a0 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inferencing.scala @@ -123,7 +123,7 @@ object Inferencing { def inferTypeParams(tree: Tree, pt: Type)(implicit ctx: Context): Tree = tree.tpe match { case tl: TypeLambda => val (tl1, tvars) = constrained(tl, tree) - val tree1 = tree.withType(tl1).appliedToTypeTrees(tvars) + var tree1 = AppliedTypeTree(tree.withType(tl1), tvars) tree1.tpe <:< pt fullyDefinedType(tree1.tpe, "template parent", tree.pos) tree1 From 60efdfce7df3ceeab59a774883712eb88db05ff1 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 20 Jul 2017 13:19:34 +0200 Subject: [PATCH 2/2] Add test --- tests/pos/i2637.scala | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/pos/i2637.scala diff --git a/tests/pos/i2637.scala b/tests/pos/i2637.scala new file mode 100644 index 000000000000..ce004c0ece64 --- /dev/null +++ b/tests/pos/i2637.scala @@ -0,0 +1,10 @@ +object Hello { + def main(args: Array[String]): Unit = { + sealed trait Wat[T] + + implicit def intWat: Wat[Int] = ??? + implicit def listWat[T](implicit tWat: Wat[T]): Wat[List[T]] = new Wat{} + + def stuff[T](implicit implicitWat: => Wat[List[T]]): Unit = ??? + } +}