aboutsummaryrefslogtreecommitdiff
path: root/pretyping
diff options
context:
space:
mode:
authorherbelin2013-02-28 07:33:37 +0000
committerherbelin2013-02-28 07:33:37 +0000
commitc43f9128237ac16fa0d7741744e3944ca72e7475 (patch)
tree9d36fa1cb3364d16c00e506d786822303b6a027c /pretyping
parent87bd13c7a6552f33782e0e69ef705b356a2cf741 (diff)
More informative error when a global reference is used in a context of
local variables which is a different from the one of its definition. E.g.: Section A. Variable n:nat. Definition c:=n. Goal True. clear n. Check c. [I'm however unsure that "n" should not continue to be accessible via some global (qualified) name, even after the "clear n".] git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16256 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'pretyping')
-rw-r--r--pretyping/nativenorm.ml5
-rw-r--r--pretyping/vnorm.ml6
2 files changed, 7 insertions, 4 deletions
diff --git a/pretyping/nativenorm.ml b/pretyping/nativenorm.ml
index 0ecbfdbb4c..6af9ff3233 100644
--- a/pretyping/nativenorm.ml
+++ b/pretyping/nativenorm.ml
@@ -167,8 +167,9 @@ let rec nf_val env v typ =
let lvl = nb_rel env in
let name,dom,codom =
try decompose_prod env typ
- with _ -> (* TODO: is this the right exception to raise? *)
- raise (Type_errors.TypeError(env,Type_errors.ReferenceVariables typ))
+ with Invalid_argument _ ->
+ Errors.anomaly
+ (Pp.strbrk "Returned a functional value in a type not recognized as a product type.")
in
let env = push_rel (name,None,dom) env in
let body = nf_val env (f (mk_rel_accu lvl)) codom in
diff --git a/pretyping/vnorm.ml b/pretyping/vnorm.ml
index 82eccab96d..b18719cc27 100644
--- a/pretyping/vnorm.ml
+++ b/pretyping/vnorm.ml
@@ -249,8 +249,10 @@ and nf_fun env f typ =
let vb = body_of_vfun k f in
let name,dom,codom =
try decompose_prod env typ
- with _ ->
- raise (Type_errors.TypeError(env,Type_errors.ReferenceVariables typ))
+ with Invalid_argument _ ->
+ (* 27/2/13: Turned this into an anomaly *)
+ Errors.anomaly
+ (Pp.strbrk "Returned a functional value in a type not recognized as a product type.")
in
let body = nf_val (push_rel (name,None,dom) env) vb codom in
mkLambda(name,dom,body)