Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match types amendment: extractors follow aliases and singletons #84

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions content/match-types-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,18 @@ At the top level, `variance = 1` and `scrutIsWidenedAbstract = false`.
* If `q` is a skolem type `∃α:X`, fail as not specific.
* Otherwise, compute `matchPattern(ti, q.Y, 0, scrutIsWidenedAbstract)`.
* Otherwise, the underlying type definition of `q.Y` is of the form `= U`:
* If `q` is a skolem type `∃α:X` and `U` refers to `α`, fail as not specific.
* Otherwise, compute `matchPattern(ti, U, 0, scrutIsWidenedAbstract)`.
* If `q` is not a skolem type `∃α:X`, compute `matchPattern(ti, U, 0, scrutIsWidenedAbstract)`.
* Otherwise, let `U' = dropSkolem(U)` be computed as follow:
* `dropSkolem(q)` is undefined.
* `dropSkolem(p.T) = p'.T` where `p' = dropSkolem(p)` if the latter is defined. Otherwise:
* If the underlying type of `p.T` is of the form `= V`, then `dropSkolem(V)`.
* Otherwise `dropSkolem(p.T)` is undefined.
* `dropSkolem(p.x) = p'.x` where `p' = dropSkolem(p)` if the latter is defined. Otherwise:
* If the dealiased underlying type of `p.x` is a singleton type `r.y`, then `dropSkolem(r.y)`.
* Otherwise `dropSkolem(p.x)` is undefined.
* For all other types `Y`, `dropSkolem(Y)` is the type formed by replacing each component `Z` of `Y` by `dropSkolem(Z)`.
* If `U'` is undefined, fail as not specific.
* Otherwise, compute `matchPattern(ti, U', 0, scrutIsWidenedAbstract)`.
* If `T` is a concrete type alias to a type lambda:
* Let `P'` be the beta-reduction of `P`.
* Compute `matchPattern(P', X, variance, scrutIsWidenedAbstract)`.
Expand Down