File tree 1 file changed +5
-4
lines changed
compiler/src/dotty/tools/dotc/typer
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
3410
3410
case _ =>
3411
3411
}
3412
3412
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)
3414
3418
gadts.println(
3415
3419
i """ GADT approximation {
3416
3420
approximation = $gadtApprox
3417
- pt.isInstanceOf[SelectionProto] = ${pt.isInstanceOf [SelectionProto ]}
3418
- ctx.gadt.nonEmpty = ${ctx.gadt.nonEmpty}
3419
- ctx.gadt = ${ctx.gadt.debugBoundsDescription}
3420
3421
pt.isMatchedBy = ${
3421
3422
if (pt.isInstanceOf [SelectionProto ])
3422
3423
pt.asInstanceOf [SelectionProto ].isMatchedBy(gadtApprox).toString
You can’t perform that action at this time.
0 commit comments