Skip to content

Commit

Permalink
Merge pull request #77 from sjrd/match-types-fix-wildcard-capture-logic
Browse files Browse the repository at this point in the history
Match types: fix wildcard captures handling to match intent.
  • Loading branch information
anatoliykmetyuk authored Feb 20, 2024
2 parents 8a15186 + 208a424 commit e66ab23
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions content/match-types-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,9 @@ At the top level, `variance = 1` and `scrutIsWidenedAbstract = false`.
* If `P` is a `TypeWithoutCapture`:
* Do nothing (always succeed).
* If `P` is a `WildcardCapture` `ti = _`:
* If `X` is of the form `_ >: L <: H`, instantiate `ti := H` (anything between `L` and `H` would work here),
* Otherwise, instantiate `ti := X`.
* Instantiate `ti` so that the subtype test in Step (2) above always succeeds:
* If `X` is of the form `_ >: L <: H`, instantiate `ti := H` (resp. `L`, `X`) if `variance = 1` (resp. `-1`, `0`).
* Otherwise, instantiate `ti := X`.
* If `P` is a `TypeCapture` `ti`:
* If `X` is of the form `_ >: L <: H`,
* If `scrutIsWidenedAbstract` is `true`, fail as not specific.
Expand Down

0 comments on commit e66ab23

Please sign in to comment.