Skip to content

Commit 4dd43c8

Browse files
committed
Type check expressions during construction
1 parent 801e1b7 commit 4dd43c8

27 files changed

+789
-658
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
@@ -150,9 +150,11 @@ module DolmenIntf = struct
150150

151151
let to_ety (ty : DTy.t) : Ty.t =
152152
match ty with
153-
| { ty_descr = TyApp ({ builtin = DBuiltin.Int; _ }, _); _ } -> Ty_int
154-
| { ty_descr = TyApp ({ builtin = DBuiltin.Real; _ }, _); _ } -> Ty_real
155-
| { ty_descr = TyApp ({ builtin = DBuiltin.Prop; _ }, _); _ } -> Ty_bool
153+
| { ty_descr = TyApp ({ builtin = DBuiltin.Int; _ }, _); _ } -> Ty Ty_int
154+
| { ty_descr = TyApp ({ builtin = DBuiltin.Real; _ }, _); _ } ->
155+
Ty Ty_real
156+
| { ty_descr = TyApp ({ builtin = DBuiltin.Prop; _ }, _); _ } ->
157+
Ty Ty_bool
156158
| { ty_descr =
157159
TyApp
158160
( { builtin = DBuiltin.Base
@@ -162,13 +164,13 @@ module DolmenIntf = struct
162164
, _ )
163165
; _
164166
} ->
165-
Ty_str
167+
Ty Ty_str
166168
| { ty_descr = TyApp ({ builtin = DBuiltin.Bitv n; _ }, _); _ } ->
167-
Ty_bitv n
169+
Ty (Ty_bitv n)
168170
| { ty_descr = TyApp ({ builtin = DBuiltin.Float (8, 24); _ }, _); _ } ->
169-
Ty_fp 32
171+
Ty (Ty_fp 32)
170172
| { ty_descr = TyApp ({ builtin = DBuiltin.Float (11, 53); _ }, _); _ } ->
171-
Ty_fp 64
173+
Ty (Ty_fp 64)
172174
| _ -> Fmt.failwith {|Unsupported dolmen type "%a"|} DTy.print ty
173175
end
174176

src/smtml/dune

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
symbol
5252
ty
5353
utils
54+
utils_parse
5455
value
5556
z3_mappings)
5657
(private_modules lexer parser)

0 commit comments

Comments
 (0)