File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -3410,13 +3410,14 @@ class Typer extends Namer
34103410 case _ =>
34113411 }
34123412
3413- val gadtApprox = Inferencing .approximateGADT(wtp)
3413+ // try GADT approximation, but only if we're trying to select a member
3414+ // Member lookup cannot take GADTs into account b/c of cache, so we
3415+ // approximate types based on GADT constraints instead. For an example,
3416+ // see MemberHealing in gadt-approximation-interaction.scala.
3417+ lazy val gadtApprox = Inferencing .approximateGADT(wtp)
34143418 gadts.println(
34153419 i """ GADT approximation {
34163420 approximation = $gadtApprox
3417- pt.isInstanceOf[SelectionProto] = ${pt.isInstanceOf [SelectionProto ]}
3418- ctx.gadt.nonEmpty = ${ctx.gadt.nonEmpty}
3419- ctx.gadt = ${ctx.gadt.debugBoundsDescription}
34203421 pt.isMatchedBy = ${
34213422 if (pt.isInstanceOf [SelectionProto ])
34223423 pt.asInstanceOf [SelectionProto ].isMatchedBy(gadtApprox).toString
You can’t perform that action at this time.
0 commit comments