diff options
| author | coqbot | 2020-08-17 16:10:31 +0200 |
|---|---|---|
| committer | GitHub | 2020-08-17 16:10:31 +0200 |
| commit | 55c66171b18f6aecf6e5ce4f5e06fccb85004df7 (patch) | |
| tree | c7323c0c25ec9ca765f10a8b3e22b0c4404c097d | |
| parent | 700aaaacad67d5d5f47805d9aa817213c84cfc02 (diff) | |
| parent | 0e96c241550c4a8abf65f3bb63fcd7cab3380e92 (diff) | |
Merge PR #12802: Document semantic restriction on patterns in Gallina match construct
Reviewed-by: Zimmi48
Ack-by: gares
Ack-by: jfehrle
| -rw-r--r-- | doc/sphinx/language/core/variants.rst | 15 | ||||
| -rw-r--r-- | interp/constrintern.ml | 3 |
2 files changed, 12 insertions, 6 deletions
diff --git a/doc/sphinx/language/core/variants.rst b/doc/sphinx/language/core/variants.rst index d00a2f4100..8e2bf32dd6 100644 --- a/doc/sphinx/language/core/variants.rst +++ b/doc/sphinx/language/core/variants.rst @@ -57,6 +57,11 @@ Private (matching) inductive types Definition by cases: match -------------------------- +Objects of inductive types can be destructured by a case-analysis +construction called *pattern matching* expression. A pattern matching +expression is used to analyze the structure of an inductive object and +to apply specific treatments accordingly. + .. insertprodn term_match pattern0 .. prodn:: @@ -77,10 +82,12 @@ Definition by cases: match | @numeral | @string -Objects of inductive types can be destructured by a case-analysis -construction called *pattern matching* expression. A pattern matching -expression is used to analyze the structure of an inductive object and -to apply specific treatments accordingly. +Note that the :n:`@pattern ::= @pattern10 : @term` production +is not supported in :n:`match` patterns. Trying to use it will give this error: + +.. exn:: Casts are not supported in this pattern. + :undocumented: + This paragraph describes the basic form of pattern matching. See Section :ref:`Mult-match` and Chapter :ref:`extendedpatternmatching` for the description diff --git a/interp/constrintern.ml b/interp/constrintern.ml index 6d4ab8b4d6..1d3b1bbb24 100644 --- a/interp/constrintern.ml +++ b/interp/constrintern.ml @@ -1724,8 +1724,7 @@ let drop_notations_pattern looked_for genv = the domains of lambdas in the encoding of match in constr. This check is here and not in the parser because it would require duplicating the levels of the [pattern] rule. *) - CErrors.user_err ?loc ~hdr:"drop_notations_pattern" - (Pp.strbrk "Casts are not supported in this pattern.") + CErrors.user_err ?loc (Pp.strbrk "Casts are not supported in this pattern.") and in_pat_sc scopes x = in_pat false (x,snd scopes) and in_not top loc scopes (subst,substlist as fullsubst) args = function | NVar id -> |
