aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interp/constrintern.ml2
-rw-r--r--pretyping/pretyping.ml10
-rw-r--r--test-suite/bugs/closed/bug_11935.v6
3 files changed, 16 insertions, 2 deletions
diff --git a/interp/constrintern.ml b/interp/constrintern.ml
index 905d9f1e5b..45255609e0 100644
--- a/interp/constrintern.ml
+++ b/interp/constrintern.ml
@@ -989,7 +989,7 @@ let string_of_ty = function
| Variable -> "var"
let gvar (loc, id) us = match us with
-| None -> DAst.make ?loc @@ GVar id
+| None | Some [] -> DAst.make ?loc @@ GVar id
| Some _ ->
user_err ?loc (str "Variable " ++ Id.print id ++
str " cannot have a universe instance")
diff --git a/pretyping/pretyping.ml b/pretyping/pretyping.ml
index 015c26531a..940150b15a 100644
--- a/pretyping/pretyping.ml
+++ b/pretyping/pretyping.ml
@@ -438,7 +438,15 @@ let pretype_ref ?loc sigma env ref us =
match ref with
| GlobRef.VarRef id ->
(* Section variable *)
- (try sigma, make_judge (mkVar id) (NamedDecl.get_type (lookup_named id !!env))
+ (try
+ let ty = NamedDecl.get_type (lookup_named id !!env) in
+ (match us with
+ | None | Some [] -> ()
+ | Some (_ :: _) ->
+ CErrors.user_err ?loc
+ Pp.(str "Section variables are not polymorphic:" ++ spc ()
+ ++ str "universe instance should have length 0."));
+ sigma, make_judge (mkVar id) ty
with Not_found ->
(* This may happen if env is a goal env and section variables have
been cleared - section variables should be different from goal
diff --git a/test-suite/bugs/closed/bug_11935.v b/test-suite/bugs/closed/bug_11935.v
new file mode 100644
index 0000000000..ad5ffc68b5
--- /dev/null
+++ b/test-suite/bugs/closed/bug_11935.v
@@ -0,0 +1,6 @@
+Section S.
+ Variable A : Prop.
+
+ Fail Check A@{Type}.
+ Check A@{}.
+End S.