You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Specially, if for some `Aᵢ`, `p.Aᵢ` is abstract while `q.Aᵢ` is not, we will extract constraints
210
211
* for both directions of the subtype relations (i.e. both `p.Aᵢ <:< q.Aᵢ` and `q.Aᵢ <:< p.Aᵢ`).
211
212
*
212
-
* How we find out and handle the path (`TermRef`) of the scrutinee and pattern.
213
+
* How we find out and handle the path (`TermRef`) of the scrutinee and pattern:
213
214
*
214
-
* - The path of scrutinee is not directly available in `constrainPatternType`, since the scrutinee type
215
-
* passed to this function is widened.
216
-
* To make the path available during GADT reasoning, we save the scrutinee path in `Typer.typedCase`. The scrutinee path will be saved in `ctx.gadt.scrutineePath`.
217
-
* Note that we have to clear the saved scrutinee path after using by calling `ctx.gadt.resetScrutineePath()`.
215
+
* - The path of scrutinee is not directly available in `constrainPatternType`, since the scrutinee type passed to this function is widened.
216
+
* To have access to the scrutinee path here, we save the scrutinee path in `Typer.typedCase` with `GadtConstraint.withScrutineePath`,
217
+
* and the scrutinee path will be accessible as `ctx.gadt.scrutineePath`.
218
+
* Note that we have to reset the saved scrutinee path to `null` after using by calling `ctx.gadt.resetScrutineePath()`.
218
219
* This is because `constrainPatternType` may be called multiple times for one nested pattern. For example:
0 commit comments