Commit 6e1bd669 authored by Andrei Paskevich's avatar Andrei Paskevich

Expr: remove dangerous variants from rs_kind

parent 74afbb53
......@@ -886,8 +886,7 @@ let cty_of_spec env bl dsp dity =
let val_decl env (id,ghost,kind,bl,dsp,dity) =
let ity = ity_of_dity dity in match kind with
| RKfunc n when n > 0 -> invalid_arg "Dexpr.val_decl"
| RKpv _ | RKlocal -> invalid_arg "Dexpr.val_decl"
| RKlocal -> invalid_arg "Dexpr.val_decl"
| _ when bl <> [] ->
let c = cty_of_spec env bl dsp dity in
ValS (create_rsymbol id ~ghost ~kind c)
......@@ -909,7 +908,7 @@ let val_decl env (id,ghost,kind,bl,dsp,dity) =
ValV (create_pvsymbol id ~ghost ity)
| RKnone -> Loc.errorm
"Mutable top-level variables must have monomorphic type"
| RKfunc _ -> Loc.errorm
| RKfunc -> Loc.errorm
"Mutable top-level variables cannot be logical functions"
| RKpred -> Loc.errorm
"Mutable top-level variables cannot be logical predicates"
......
This diff is collapsed.
......@@ -40,12 +40,11 @@ val rs_equal : rsymbol -> rsymbol -> bool
val rs_hash : rsymbol -> int
type rs_kind =
| RKnone (* non-pure symbol *)
| RKpv of pvsymbol (* local let-function *)
| RKlocal (* new local let-function *)
| RKfunc of int (* new top-level let-function or constructor *)
| RKpred (* new top-level let-predicate *)
| RKlemma (* top-level or local let-lemma *)
| RKnone (* non-pure symbol *)
| RKlocal (* local let-function *)
| RKfunc (* top-level let-function *)
| RKpred (* top-level let-predicate *)
| RKlemma (* top-level or local let-lemma *)
val create_rsymbol : preid -> ?ghost:bool -> ?kind:rs_kind -> cty -> rsymbol
(** If [?kind] is supplied and is not [RKnone], then [cty]
......@@ -57,6 +56,9 @@ val create_rsymbol : preid -> ?ghost:bool -> ?kind:rs_kind -> cty -> rsymbol
type must be [ity_bool]. If [?kind] is [RKlemma] and the result
type is not [ity_unit], an existential premise is generated. *)
val create_constructor :
constr:int -> preid -> itysymbol -> pvsymbol list -> rsymbol
val create_field : preid -> itysymbol -> pvsymbol -> rsymbol
val restore_rs : lsymbol -> rsymbol
......
......@@ -952,6 +952,7 @@ let cty_apply ?(ghost=false) c vl args res =
ity_match (List.fold_left2 match_v isb rcargs rargs) cres res in
let eff = if same then c.cty_effect else eff_full_inst isb c.cty_effect in
(* stage 3: cty-to-mapping type cast *)
(* TODO: use Term.t_closure in posts for let-functions *)
let post = if cargs = [] then c.cty_post else begin
if c.cty_pre <> [] then Loc.errorm
"this function is partial, it cannot be used as first-order";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment