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
3407
3407
case _ =>
3408
3408
}
3409
3409
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)
3411
3415
gadts.println(
3412
3416
i """ GADT approximation {
3413
3417
approximation = $gadtApprox
3414
- pt.isInstanceOf[SelectionProto] = ${pt.isInstanceOf [SelectionProto ]}
3415
- ctx.gadt.nonEmpty = ${ctx.gadt.nonEmpty}
3416
- ctx.gadt = ${ctx.gadt.debugBoundsDescription}
3417
3418
pt.isMatchedBy = ${
3418
3419
if (pt.isInstanceOf [SelectionProto ])
3419
3420
pt.asInstanceOf [SelectionProto ].isMatchedBy(gadtApprox).toString
You can’t perform that action at this time.
0 commit comments