Skip to content

Commit 35bc8d0

Browse files
committed
Type check expressions during construction
1 parent edd3ddd commit 35bc8d0

23 files changed

+690
-615
lines changed

doc/examples/product_mix.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let read_int () = Scanf.scanf " %d" (fun x -> x)
55

66
let int x = Expr.value (Int x)
77

8-
let symbol x = Expr.symbol Symbol.(x @: Ty_int)
8+
let symbol x = Expr.symbol Symbol.(x @: Ty Ty_int)
99

1010
let ( = ) i1 i2 = Expr.relop Ty_bool Eq i1 i2
1111

src/smtml/altergo_mappings.default.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,10 @@ module M = struct
207207
module Model = struct
208208
let aety_to_ty (ty : AEL.Ty.t) : Ty.t =
209209
match ty with
210-
| Tbool -> Ty_bool
211-
| Tint -> Ty_int
212-
| Treal -> Ty_real
213-
| Tbitv n -> Ty_bitv n
210+
| Tbool -> Ty Ty_bool
211+
| Tint -> Ty Ty_int
212+
| Treal -> Ty Ty_real
213+
| Tbitv n -> Ty (Ty_bitv n)
214214
| _ -> assert false
215215

216216
let aeid_to_sym ((hs, tyl, ty) : AEL.Id.typed) =

src/smtml/dolmenexpr_to_expr.ml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,11 @@ module DolmenIntf = struct
156156

157157
let to_ety (ty : DTy.t) : Ty.t =
158158
match ty with
159-
| { ty_descr = TyApp ({ builtin = DBuiltin.Int; _ }, _); _ } -> Ty_int
160-
| { ty_descr = TyApp ({ builtin = DBuiltin.Real; _ }, _); _ } -> Ty_real
161-
| { ty_descr = TyApp ({ builtin = DBuiltin.Prop; _ }, _); _ } -> Ty_bool
159+
| { ty_descr = TyApp ({ builtin = DBuiltin.Int; _ }, _); _ } -> Ty Ty_int
160+
| { ty_descr = TyApp ({ builtin = DBuiltin.Real; _ }, _); _ } ->
161+
Ty Ty_real
162+
| { ty_descr = TyApp ({ builtin = DBuiltin.Prop; _ }, _); _ } ->
163+
Ty Ty_bool
162164
| { ty_descr =
163165
TyApp
164166
( { builtin = DBuiltin.Base
@@ -168,13 +170,13 @@ module DolmenIntf = struct
168170
, _ )
169171
; _
170172
} ->
171-
Ty_str
173+
Ty Ty_str
172174
| { ty_descr = TyApp ({ builtin = DBuiltin.Bitv n; _ }, _); _ } ->
173-
Ty_bitv n
175+
Ty (Ty_bitv n)
174176
| { ty_descr = TyApp ({ builtin = DBuiltin.Float (8, 24); _ }, _); _ } ->
175-
Ty_fp 32
177+
Ty (Ty_fp 32)
176178
| { ty_descr = TyApp ({ builtin = DBuiltin.Float (11, 53); _ }, _); _ } ->
177-
Ty_fp 64
179+
Ty (Ty_fp 64)
178180
| _ -> Fmt.failwith {|Unsupported dolmen type "%a"|} DTy.print ty
179181
end
180182

0 commit comments

Comments
 (0)