X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fcontent_pres%2FtermContentPres.ml;h=bffd189761651095760df44d24edaee55633716f;hb=54551ce5acf37f04972291e774d14371a671a8c7;hp=691d4426d80a40638add6815bf303bddd4781c5e;hpb=68f3812e06c04ddd664e86dbfd3a1c32f96a22d1;p=helm.git diff --git a/helm/software/components/content_pres/termContentPres.ml b/helm/software/components/content_pres/termContentPres.ml index 691d4426d..bffd18976 100644 --- a/helm/software/components/content_pres/termContentPres.ml +++ b/helm/software/components/content_pres/termContentPres.ml @@ -196,7 +196,7 @@ let pp_ast0 t k = hvbox false true [ aux_var var; space; builtin_symbol "\\def"; break; top_pos (k s) ]; - break; space; keyword "in" ]; + break; space; keyword "in"; space ]; break; k t ]) | Ast.LetRec (rec_kind, funs, where) -> @@ -319,7 +319,11 @@ let instantiate21 idrefs env l1 = assert (CicNotationEnv.well_typed ty value); (* INVARIANT *) (* following assertion should be a conditional that makes this * instantiation fail *) - assert (CicNotationEnv.well_typed expected_ty value); + if not (CicNotationEnv.well_typed expected_ty value) then + begin + prerr_endline ("The variable " ^ name ^ " is used with the wrong type in the notation declaration"); + assert false + end; let value = CicNotationEnv.term_of_value value in let value = match expected_ty with @@ -346,7 +350,7 @@ let instantiate21 idrefs env l1 = let sep = match sep_opt with | None -> [] - | Some l -> [ Ast.Literal l ] + | Some l -> [ Ast.Literal l; break; space ] in let rec instantiate_list acc = function | [] -> List.rev acc @@ -359,7 +363,8 @@ let instantiate21 idrefs env l1 = let terms = subst pos env p in instantiate_list (CicNotationUtil.group (terms @ sep) :: acc) tl in - instantiate_list [] values + if values = [] then [] + else [hovbox false false (instantiate_list [] values)] | Ast.Opt p -> let opt_decls = CicNotationEnv.declarations_of_term p in let env = @@ -511,6 +516,8 @@ let head_names names env = (match ty, v with | Env.ListType ty, Env.ListValue (v :: _) -> aux ((name, (ty, v)) :: acc) tl + | Env.TermType _, Env.TermValue _ -> + aux ((name, (ty, v)) :: acc) tl | _ -> assert false) | _ :: tl -> aux acc tl (* base pattern may contain only meta names, thus we trash all others *) @@ -524,6 +531,8 @@ let tail_names names env = (match ty, v with | Env.ListType ty, Env.ListValue (_ :: vtl) -> aux ((name, (Env.ListType ty, Env.ListValue vtl)) :: acc) tl + | Env.TermType _, Env.TermValue _ -> + aux ((name, (ty, v)) :: acc) tl | _ -> assert false) | binding :: tl -> aux (binding :: acc) tl | [] -> acc