From 2023f04036718897b5cb48736a89e2bf7fb585da Mon Sep 17 00:00:00 2001 From: nmcb Date: Wed, 28 Sep 2022 13:34:32 +0200 Subject: [PATCH 1/2] updated docs after #16021 was closed --- docs/_docs/reference/new-types/match-types.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/_docs/reference/new-types/match-types.md b/docs/_docs/reference/new-types/match-types.md index 9fcee09c34f5..0153a135b8e7 100644 --- a/docs/_docs/reference/new-types/match-types.md +++ b/docs/_docs/reference/new-types/match-types.md @@ -83,6 +83,12 @@ following conditions are met: and these types are `=:=` to their corresponding type patterns in the match type +So you know, While the case body will be expected to have the type on the right-hand +side of the corresponding match type case, that doesn't imply the match type argument +is constrained. Using the example, the last case body must conform to X, but that +doesn't constrain X to be AnyVal, and therefore a LeafElem[X] inside the body wouldn't +reduce; it would remain stuck, and as such just an abstract type. + ## Representation of Match Types The internal representation of a match type From a746a7f3026c824a88bce4531cce7045bf1f4ab1 Mon Sep 17 00:00:00 2001 From: "nmc.borst" Date: Wed, 28 Sep 2022 13:41:31 +0200 Subject: [PATCH 2/2] Update match-types.md corrected syntax --- docs/_docs/reference/new-types/match-types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_docs/reference/new-types/match-types.md b/docs/_docs/reference/new-types/match-types.md index 0153a135b8e7..d646dd11880b 100644 --- a/docs/_docs/reference/new-types/match-types.md +++ b/docs/_docs/reference/new-types/match-types.md @@ -83,7 +83,7 @@ following conditions are met: and these types are `=:=` to their corresponding type patterns in the match type -So you know, While the case body will be expected to have the type on the right-hand +So you know, while the case body will be expected to have the type on the right-hand side of the corresponding match type case, that doesn't imply the match type argument is constrained. Using the example, the last case body must conform to X, but that doesn't constrain X to be AnyVal, and therefore a LeafElem[X] inside the body wouldn't