From 30fa1ad3b0fd9a47f63382d1213268d77bd88ad6 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 8 Jan 2020 11:40:47 +0100 Subject: [PATCH] Fix #7863: Handle type lambda trees in inlined code --- compiler/src/dotty/tools/dotc/typer/Inliner.scala | 4 +++- tests/pos/i7863.scala | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/pos/i7863.scala diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala index 70861d4be87c..a1315dcc0d16 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala @@ -439,7 +439,9 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) { paramProxy(param.typeRef) = adaptToPrefix(param.typeRef) case tpe: NamedType if tpe.symbol.is(Param) && tpe.symbol.owner == inlinedMethod && !paramProxy.contains(tpe) => - paramProxy(tpe) = paramBinding(tpe.name) + paramBinding.get(tpe.name) match + case Some(bound) => paramProxy(tpe) = bound + case _ => // can happen for params bound by type-lambda trees. case _ => } diff --git a/tests/pos/i7863.scala b/tests/pos/i7863.scala new file mode 100644 index 000000000000..bd33979ef6b2 --- /dev/null +++ b/tests/pos/i7863.scala @@ -0,0 +1,5 @@ +def f[F[_]] = () + +inline def g = f[[R] =>> Int => R] + +val a = g \ No newline at end of file