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 @@ -3407,13 +3407,14 @@ class Typer extends Namer
34073407 case _ =>
34083408 }
34093409
3410- val gadtApprox = Inferencing .approximateGADT(wtp)
3410+ // try GADT approximation, but only if we're trying to select a member
3411+ // Member lookup cannot take GADTs into account b/c of cache, so we
3412+ // approximate types based on GADT constraints instead. For an example,
3413+ // see MemberHealing in gadt-approximation-interaction.scala.
3414+ lazy val gadtApprox = Inferencing .approximateGADT(wtp)
34113415 gadts.println(
34123416 i """ GADT approximation {
34133417 approximation = $gadtApprox
3414- pt.isInstanceOf[SelectionProto] = ${pt.isInstanceOf [SelectionProto ]}
3415- ctx.gadt.nonEmpty = ${ctx.gadt.nonEmpty}
3416- ctx.gadt = ${ctx.gadt.debugBoundsDescription}
34173418 pt.isMatchedBy = ${
34183419 if (pt.isInstanceOf [SelectionProto ])
34193420 pt.asInstanceOf [SelectionProto ].isMatchedBy(gadtApprox).toString
You can’t perform that action at this time.
0 commit comments