Skip to content

Commit 0896981

Browse files
committed
Adjust based on review feedback
1 parent 72916ea commit 0896981

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

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

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3411,22 +3411,14 @@ class Typer extends Namer
34113411
// Member lookup cannot take GADTs into account b/c of cache, so we
34123412
// approximate types based on GADT constraints instead. For an example,
34133413
// see MemberHealing in gadt-approximation-interaction.scala.
3414-
lazy val gadtApprox = Inferencing.approximateGADT(wtp)
3415-
gadts.println(
3416-
i"""GADT approximation {
3417-
approximation = $gadtApprox
3418-
pt.isMatchedBy = ${
3419-
if (pt.isInstanceOf[SelectionProto])
3420-
pt.asInstanceOf[SelectionProto].isMatchedBy(gadtApprox).toString
3421-
else
3422-
"<not a SelectionProto>"
3423-
}
3424-
}
3425-
"""
3426-
)
34273414
pt match {
3428-
case pt: SelectionProto if ctx.gadt.nonEmpty && pt.isMatchedBy(gadtApprox) =>
3429-
return tpd.Typed(tree, TypeTree(gadtApprox))
3415+
case pt: SelectionProto if ctx.gadt.nonEmpty =>
3416+
gadts.println(i"Trying to heal member selection by GADT-approximating $wtp")
3417+
val gadtApprox = Inferencing.approximateGADT(wtp)
3418+
gadts.println(i"GADT-approximated $wtp ~~ $gadtApprox")
3419+
if pt.isMatchedBy(gadtApprox) then
3420+
gadts.println(i"Member selection healed by GADT approximation")
3421+
return tpd.Typed(tree, TypeTree(gadtApprox))
34303422
case _ => ;
34313423
}
34323424

0 commit comments

Comments
 (0)