aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Herbelin2016-01-13 00:20:46 +0100
committerHugo Herbelin2016-01-13 00:50:21 +0100
commit2d568a895d5c8a246f497c94c79811d3aad4269f (patch)
treeea861b017fcc4526c94425bd11335c0c17c4fe95
parent9f8ae1aa2678944888d80ce0867bfb2bba0c8c71 (diff)
Fixing #4467 (continued).
Function is_constructor was not properly fixed. Additionally, this fixes a problem with the 8.5 interpretation of in-pattern (see Cases.v).
-rw-r--r--dev/printers.mllib6
-rw-r--r--interp/interp.mllib2
-rw-r--r--interp/topconstr.ml4
-rw-r--r--test-suite/success/Cases.v7
4 files changed, 14 insertions, 5 deletions
diff --git a/dev/printers.mllib b/dev/printers.mllib
index eeca6809ae..ab7e9fc346 100644
--- a/dev/printers.mllib
+++ b/dev/printers.mllib
@@ -160,14 +160,14 @@ Constrarg
Constrexpr_ops
Genintern
Notation_ops
-Topconstr
Notation
Dumpglob
+Syntax_def
+Smartlocate
+Topconstr
Reserve
Impargs
-Syntax_def
Implicit_quantifiers
-Smartlocate
Constrintern
Modintern
Constrextern
diff --git a/interp/interp.mllib b/interp/interp.mllib
index c9a0315267..96b52959a0 100644
--- a/interp/interp.mllib
+++ b/interp/interp.mllib
@@ -3,12 +3,12 @@ Constrarg
Genintern
Constrexpr_ops
Notation_ops
-Topconstr
Ppextend
Notation
Dumpglob
Syntax_def
Smartlocate
+Topconstr
Reserve
Impargs
Implicit_quantifiers
diff --git a/interp/topconstr.ml b/interp/topconstr.ml
index 560cd0277b..2cb2449b7d 100644
--- a/interp/topconstr.ml
+++ b/interp/topconstr.ml
@@ -39,7 +39,9 @@ let error_invalid_pattern_notation loc =
(* Functions on constr_expr *)
let is_constructor id =
- try ignore (Nametab.locate_extended (qualid_of_ident id)); true
+ try Globnames.isConstructRef
+ (Smartlocate.global_of_extended_global
+ (Nametab.locate_extended (qualid_of_ident id)))
with Not_found -> false
let rec cases_pattern_fold_names f a = function
diff --git a/test-suite/success/Cases.v b/test-suite/success/Cases.v
index e42663505d..49c465b6c6 100644
--- a/test-suite/success/Cases.v
+++ b/test-suite/success/Cases.v
@@ -1861,3 +1861,10 @@ Type (fun n => match n with
Definition transport {A} (P : A->Type) {x y : A} (p : x=y) (u : P x) : P y :=
match p with eq_refl => u end.
+
+(* Check in-pattern clauses with constant constructors, which were
+ previously interpreted as variables (before 8.5) *)
+
+Check match eq_refl 0 in _=O return O=O with eq_refl => eq_refl end.
+
+Check match niln in listn O return O=O with niln => eq_refl end.