Skip to content

Commit 7e9e856

Browse files
committed
Fix the matching rule for compiletime.int.S.
1 parent 580d30b commit 7e9e856

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/match-types-spec.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ At the top level, `variance = 1` and `scrutIsWidenedAbstract = false`.
272272
* Let `innerScrutIsWidenedAbstract` be true if either `scrutIsWidenedAbstract` or `X` is not a concrete type.
273273
* For each pair of `(Ui, Qi)`, compute `matchPattern(Ui, Qi, vi, innerScrutIsWidenedAbstract)` where `vi` is the variance of the `i`th type parameter of `T`.
274274
* If `T` is `scala.compiletime.ops.int.S`:
275-
* If `n = natValue(X)` is undefined or is `Int.MinValue`, fail as not matching.
276-
* Otherwise, compute `matchPattern(n, Q1, 1, scrutIsWidenedAbstract)`.
275+
* If `n = natValue(X)` is undefined or `n <= 0`, fail as not matching.
276+
* Otherwise, compute `matchPattern(n - 1, Q1, 1, scrutIsWidenedAbstract)`.
277277
* If `T` is an abstract type constructor:
278278
* If `X` is not of the form `F[Us]` or `F =:= T` is false, fail as not matching.
279279
* Otherwise, for each pair of `(Ui, Qi)`, compute `matchPattern(Ui, Qi, vi, scrutIsWidenedAbstract)` where `vi` is the variance of the `i`th type parameter of `T`.

0 commit comments

Comments
 (0)