Skip to content

Commit 0571834

Browse files
committed
Extend some more tests to include higher-kinded lambdas
I found these by systematically inspecting all usages of `widen`.
1 parent 9a545e5 commit 0571834

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/typer/Inferencing.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ object Inferencing {
238238
if (toTest.isEmpty) acc
239239
else tree match {
240240
case Apply(fn, _) =>
241-
fn.tpe.widen match {
242-
case mtp: MethodType =>
241+
fn.tpe.widen.toLambda match {
242+
case mtp: TermLambda =>
243243
val (occ, nocc) = toTest.partition(tvar => mtp.paramInfos.exists(tvar.occursIn))
244244
occurring(fn, nocc, occ ::: acc)
245245
case _ =>

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,8 +1849,8 @@ class Typer extends Namer
18491849
/** Interpolate and simplify the type of the given tree. */
18501850
protected def simplify(tree: Tree, pt: Type, locked: TypeVars)(implicit ctx: Context): tree.type = {
18511851
if (!tree.denot.isOverloaded) // for overloaded trees: resolve overloading before simplifying
1852-
if (!tree.tpe.widen.isInstanceOf[MethodOrPoly] // wait with simplifying until method is fully applied
1853-
|| tree.isDef) // ... unless tree is a definition
1852+
if (!tree.tpe.widen.toLambda.isInstanceOf[LambdaType] // wait with simplifying until lambda is fully applied
1853+
|| tree.isDef) // ... unless tree is a definition
18541854
{
18551855
interpolateTypeVars(tree, pt, locked)
18561856
tree.overwriteType(tree.tpe.simplified)

0 commit comments

Comments
 (0)