Skip to content

Commit 53ed0e9

Browse files
authored
Merge pull request #84 from smarter/dropSkolem
Match types amendment: extractors follow aliases and singletons
2 parents 86590fd + eb6d82f commit 53ed0e9

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

content/match-types-spec.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,18 @@ At the top level, `variance = 1` and `scrutIsWidenedAbstract = false`.
286286
* If `q` is a skolem type `∃α:X`, fail as not specific.
287287
* Otherwise, compute `matchPattern(ti, q.Y, 0, scrutIsWidenedAbstract)`.
288288
* Otherwise, the underlying type definition of `q.Y` is of the form `= U`:
289-
* If `q` is a skolem type `∃α:X` and `U` refers to `α`, fail as not specific.
290-
* Otherwise, compute `matchPattern(ti, U, 0, scrutIsWidenedAbstract)`.
289+
* If `q` is not a skolem type `∃α:X`, compute `matchPattern(ti, U, 0, scrutIsWidenedAbstract)`.
290+
* Otherwise, let `U' = dropSkolem(U)` be computed as follow:
291+
* `dropSkolem(q)` is undefined.
292+
* `dropSkolem(p.T) = p'.T` where `p' = dropSkolem(p)` if the latter is defined. Otherwise:
293+
* If the underlying type of `p.T` is of the form `= V`, then `dropSkolem(V)`.
294+
* Otherwise `dropSkolem(p.T)` is undefined.
295+
* `dropSkolem(p.x) = p'.x` where `p' = dropSkolem(p)` if the latter is defined. Otherwise:
296+
* If the dealiased underlying type of `p.x` is a singleton type `r.y`, then `dropSkolem(r.y)`.
297+
* Otherwise `dropSkolem(p.x)` is undefined.
298+
* For all other types `Y`, `dropSkolem(Y)` is the type formed by replacing each component `Z` of `Y` by `dropSkolem(Z)`.
299+
* If `U'` is undefined, fail as not specific.
300+
* Otherwise, compute `matchPattern(ti, U', 0, scrutIsWidenedAbstract)`.
291301
* If `T` is a concrete type alias to a type lambda:
292302
* Let `P'` be the beta-reduction of `P`.
293303
* Compute `matchPattern(P', X, variance, scrutIsWidenedAbstract)`.

0 commit comments

Comments
 (0)