Skip to content

Commit 2505e50

Browse files
committed
Type check expressions during construction
1 parent 86a6b58 commit 2505e50

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
@@ -221,10 +221,10 @@ module M = struct
221221
module Model = struct
222222
let aety_to_ty (ty : AEL.Ty.t) : Ty.t =
223223
match ty with
224-
| Tbool -> Ty_bool
225-
| Tint -> Ty_int
226-
| Treal -> Ty_real
227-
| Tbitv n -> Ty_bitv n
224+
| Tbool -> Ty Ty_bool
225+
| Tint -> Ty Ty_int
226+
| Treal -> Ty Ty_real
227+
| Tbitv n -> Ty (Ty_bitv n)
228228
| _ -> assert false
229229

230230
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
@@ -148,9 +148,11 @@ module DolmenIntf = struct
148148

149149
let to_ety (ty : DTy.t) : Ty.t =
150150
match ty with
151-
| { ty_descr = TyApp ({ builtin = DBuiltin.Int; _ }, _); _ } -> Ty_int
152-
| { ty_descr = TyApp ({ builtin = DBuiltin.Real; _ }, _); _ } -> Ty_real
153-
| { ty_descr = TyApp ({ builtin = DBuiltin.Prop; _ }, _); _ } -> Ty_bool
151+
| { ty_descr = TyApp ({ builtin = DBuiltin.Int; _ }, _); _ } -> Ty Ty_int
152+
| { ty_descr = TyApp ({ builtin = DBuiltin.Real; _ }, _); _ } ->
153+
Ty Ty_real
154+
| { ty_descr = TyApp ({ builtin = DBuiltin.Prop; _ }, _); _ } ->
155+
Ty Ty_bool
154156
| { ty_descr =
155157
TyApp
156158
( { builtin = DBuiltin.Base
@@ -160,13 +162,13 @@ module DolmenIntf = struct
160162
, _ )
161163
; _
162164
} ->
163-
Ty_str
165+
Ty Ty_str
164166
| { ty_descr = TyApp ({ builtin = DBuiltin.Bitv n; _ }, _); _ } ->
165-
Ty_bitv n
167+
Ty (Ty_bitv n)
166168
| { ty_descr = TyApp ({ builtin = DBuiltin.Float (8, 24); _ }, _); _ } ->
167-
Ty_fp 32
169+
Ty (Ty_fp 32)
168170
| { ty_descr = TyApp ({ builtin = DBuiltin.Float (11, 53); _ }, _); _ } ->
169-
Ty_fp 64
171+
Ty (Ty_fp 64)
170172
| _ -> Fmt.failwith {|Unsupported dolmen type "%a"|} DTy.print ty
171173
end
172174

0 commit comments

Comments
 (0)