aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Blaauwbroek2018-09-20 21:05:19 +0200
committerHugo Herbelin2018-10-11 18:45:05 +0200
commit74f8e4b04f59c79fc2320b63f7d8c0cb4de69e2b (patch)
treeae1bec8b4f9f16243d4b32da9aabe13103ae5896
parentca0f034f5b26132f540e0018db09046d8efc5be9 (diff)
Check that lambda/prod ast's have proper binders during interning/printing.
-rw-r--r--interp/constrintern.ml5
-rw-r--r--printing/ppconstr.ml2
2 files changed, 3 insertions, 4 deletions
diff --git a/interp/constrintern.ml b/interp/constrintern.ml
index d02f59414e..d7497d4e8e 100644
--- a/interp/constrintern.ml
+++ b/interp/constrintern.ml
@@ -1863,12 +1863,11 @@ let internalize globalenv env pattern_mode (_, ntnvars as lvar) c =
Array.map (fun (bl,_,_) -> bl) idl,
Array.map (fun (_,ty,_) -> ty) idl,
Array.map (fun (_,_,bd) -> bd) idl)
+ | CProdN ([],c2) -> anomaly (Pp.str "The AST is malformed, found prod without binders.")
| CProdN (bl,c2) ->
let (env',bl) = List.fold_left intern_local_binder (env,[]) bl in
expand_binders ?loc mkGProd bl (intern_type env' c2)
- | CLambdaN ([],c2) ->
- (* Such a term is built sometimes: it should not change scope *)
- intern env c2
+ | CLambdaN ([],c2) -> anomaly (Pp.str "The AST is malformed, found lambda without binders.")
| CLambdaN (bl,c2) ->
let (env',bl) = List.fold_left intern_local_binder (reset_tmp_scope env,[]) bl in
expand_binders ?loc mkGLambda bl (intern env' c2)
diff --git a/printing/ppconstr.ml b/printing/ppconstr.ml
index e7f995c84e..6d53349fa1 100644
--- a/printing/ppconstr.ml
+++ b/printing/ppconstr.ml
@@ -394,7 +394,7 @@ let tag_var = tag Tag.variable
kw n ++ pr_binder false pr_c (nal,k,t)
| (CLocalAssum _ | CLocalPattern _ | CLocalDef _) :: _ as bdl ->
kw n ++ pr_undelimited_binders sep pr_c bdl
- | [] -> assert false
+ | [] -> anomaly (Pp.str "The ast is malformed, found lambda/prod without proper binders.")
let pr_binders_gen pr_c sep is_open =
if is_open then pr_delimited_binders pr_com_at sep pr_c