diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/rewrites.ml | 3 | ||||
| -rw-r--r-- | src/type_check.ml | 18 | ||||
| -rw-r--r-- | src/type_check.mli | 4 |
3 files changed, 4 insertions, 21 deletions
diff --git a/src/rewrites.ml b/src/rewrites.ml index 5cbc3545..45b6fd6c 100644 --- a/src/rewrites.ml +++ b/src/rewrites.ml @@ -238,7 +238,7 @@ let lookup_constant_kid env kid = List.fold_left check_nc None (Env.get_constraints env) let rec rewrite_nexp_ids env (Nexp_aux (nexp, l) as nexp_aux) = match nexp with - | Nexp_id id -> rewrite_nexp_ids env (Env.get_num_def id env) + | Nexp_id id -> Env.expand_nexp_synonyms env nexp_aux | Nexp_var kid -> begin match lookup_constant_kid env kid with @@ -2909,7 +2909,6 @@ let rewrite_defs_internal_lets = type of the storage, so ask the type checker what it really is. *) (match infer_lexp (env_of_annot lannot) (strip_lexp lhs) with | LEXP_aux (_,lexp_annot') -> lexp_annot' - | _ -> lannot | exception _ -> lannot) in let rhs = add_e_cast ltyp (rhs exp) in diff --git a/src/type_check.ml b/src/type_check.ml index b2bf0f5b..77e45752 100644 --- a/src/type_check.ml +++ b/src/type_check.ml @@ -108,7 +108,6 @@ type env = typ_vars : (Ast.l * kind_aux) KBindings.t; shadow_vars : int KBindings.t; typ_synonyms : (env -> typ_arg list -> typ_arg) Bindings.t; - num_defs : nexp Bindings.t; overloads : (id list) Bindings.t; flow : (typ -> typ) Bindings.t; enums : IdSet.t Bindings.t; @@ -368,8 +367,6 @@ module Env : sig val add_ret_typ : typ -> t -> t val add_typ_synonym : id -> (t -> typ_arg list -> typ_arg) -> t -> t val get_typ_synonym : id -> t -> t -> typ_arg list -> typ_arg - val add_num_def : id -> nexp -> t -> t - val get_num_def : id -> t -> nexp val add_overloads : id -> id list -> t -> t val get_overloads : id -> t -> id list val is_extern : id -> t -> string -> bool @@ -391,6 +388,7 @@ module Env : sig val lookup_id : ?raw:bool -> id -> t -> typ lvar val fresh_kid : ?kid:kid -> t -> kid val expand_synonyms : t -> typ -> typ + val expand_nexp_synonyms : t -> nexp -> nexp val expand_constraint_synonyms : t -> n_constraint -> n_constraint val base_typ_of : t -> typ -> typ val allow_unknowns : t -> bool @@ -430,7 +428,6 @@ end = struct typ_vars = KBindings.empty; shadow_vars = KBindings.empty; typ_synonyms = Bindings.empty; - num_defs = Bindings.empty; overloads = Bindings.empty; flow = Bindings.empty; enums = Bindings.empty; @@ -1089,19 +1086,6 @@ end = struct { env with typ_vars = KBindings.add v (l, k) env.typ_vars } end - let add_num_def id nexp env = - if Bindings.mem id env.num_defs - then typ_error env (id_loc id) ("Num identifier " ^ string_of_id id ^ " is already bound") - else - begin - typ_print (lazy (adding ^ "Num identifier " ^ string_of_id id ^ " : " ^ string_of_nexp nexp)); - { env with num_defs = Bindings.add id nexp env.num_defs } - end - - let get_num_def id env = - try Bindings.find id env.num_defs with - | Not_found -> typ_raise env (id_loc id) (Err_no_num_ident id) - let get_constraints env = env.constraints let add_constraint constr env = diff --git a/src/type_check.mli b/src/type_check.mli index 801a07ec..81f769ba 100644 --- a/src/type_check.mli +++ b/src/type_check.mli @@ -158,8 +158,6 @@ module Env : sig val get_overloads : id -> t -> id list - val get_num_def : id -> t -> nexp - val is_extern : id -> t -> string -> bool val get_extern : id -> t -> string -> string @@ -188,6 +186,8 @@ module Env : sig val expand_constraint_synonyms : t -> n_constraint -> n_constraint + val expand_nexp_synonyms : t -> nexp -> nexp + val expand_synonyms : t -> typ -> typ (** Expand type synonyms and remove register annotations (i.e. register<t> -> t)) *) |
