Skip to content

Commit 89b74b9

Browse files
committed
Update ApproximateGadtAccumulator doc
1 parent 09b5fa1 commit 89b74b9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,12 @@ object Inferencing {
198198
* - If we have A <: Int and F <: [A] => Option[A] (note the invariance),
199199
* then we should approximate F[A] ~~ Option[A]. That is, we should
200200
* respect the invariance of the type constructor.
201-
* - If we have A <: Option[B] and B <: Int, we approximate A ~~ Option[Int].
202-
* That is, we recursively approximate all nested GADT-constrained types.
203-
* This is certain to be sound (because we maintain necessary subtyping),
204-
* but not accurate.
201+
* - If we have A <: Option[B] and B <: Int, we approximate A ~~
202+
* Option[B]. That is, we don't recurse into already approximated
203+
* types. Since GADT approximation is (for now) only used for member
204+
* selection, this behaviour is expected, as nested types cannot affect
205+
* member selection (note that given/extension lookup doesn't need GADT
206+
* approx, see gadt-approximation-interaction.scala).
205207
*/
206208
def apply(tp: Type): Type = tp.dealias match {
207209
case tp @ TypeRef(qual, nme) if (qual eq NoPrefix)

0 commit comments

Comments
 (0)