Skip to content

Commit b14eb8a

Browse files
Gburybclement-ocp
andauthored
Add proper support for :named smtlib annotations (#199)
* Add implicit decls/defs * changes + some error handling * fix typo Co-authored-by: Basile Clément <[email protected]> * review * change some assert false into proper errors --------- Co-authored-by: Basile Clément <[email protected]>
1 parent 77b2550 commit b14eb8a

File tree

22 files changed

+622
-238
lines changed

22 files changed

+622
-238
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ next
3535
non linearity and other arithmetic restrictions (PR#184)
3636
- More information for reserved Id, resulting in more precise
3737
errors when smt2 scripts use reserved ids (PR#193)
38+
- Expose implicit declarations/definitions that happen during
39+
typechecking (PR#199)
40+
- Treat smtlib `:named` annotations as implicit definitions as
41+
required by the spec (PR#199)
3842

3943
### Loop
4044

doc/tuto.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ let test file =
6969
(* We can loop over the parsed statements to generated the typed statements *)
7070
let final_state, rev_typed_stmts =
7171
List.fold_left (fun (state, acc) parsed_stmt ->
72-
let state, typed_stmt = Typer.check state parsed_stmt in
73-
(state, typed_stmt :: acc)
72+
let state, typed_stmts = Typer.check state parsed_stmt in
73+
(state, List.rev_append typed_stmts acc)
7474
) (state, []) parsed_statements
7575
in
7676
let typed_stmts = List.rev rev_typed_stmts in

doc/type.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ let state =
4242
let () =
4343
let final_state, rev_typed_stmts =
4444
List.fold_left (fun (state, acc) parsed_stmt ->
45-
let state, typed_stmt = Typer.check state parsed_stmt in
46-
(state, typed_stmt :: acc)
45+
let state, typed_stmts = Typer.check state parsed_stmt in
46+
(state, List.rev_append typed_stmts acc)
4747
) (state, []) parsed
4848
in
4949
let typed_stmts = List.rev rev_typed_stmts in

src/bin/main.ml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ let debug_parsed_pipe st c =
1212
Dolmen.Std.Statement.print c;
1313
st, c
1414

15-
let debug_typed_pipe st stmt =
16-
if Loop.State.get Loop.State.debug st then
17-
Format.eprintf "[logic][typed][%a] @[<hov>%a@]@\n@."
18-
Dolmen.Std.Loc.print_compact stmt.Loop.Typer_Pipe.loc
19-
Loop.Typer_Pipe.print stmt;
20-
st, stmt
15+
let debug_typed_pipe st stmts =
16+
if Loop.State.get Loop.State.debug st then begin
17+
List.iter (fun stmt ->
18+
Format.eprintf "[logic][typed][%a] @[<hov>%a@]@\n"
19+
Dolmen.Std.Loc.print_compact stmt.Loop.Typer_Pipe.loc
20+
Loop.Typer_Pipe.print stmt) stmts;
21+
Format.eprintf "@.";
22+
end;
23+
st, stmts
2124

2225

2326
(* Run dolmen (regular use) *)

src/loop/parser.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ module Make(State : State.S) = struct
110110
(* Helper functions *)
111111
(* ************************************************************************ *)
112112

113-
114113
let gen_of_llist l =
115114
let l = ref l in
116115
(fun () -> match Lazy.force !l with

src/loop/report.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ module Error = struct
170170
let internal_error =
171171
mk ~code:Code.bug ~mnemonic:"internal-error"
172172
~message:(fun fmt t ->
173-
Format.fprintf fmt "%t" t)
173+
Format.fprintf fmt "@[<v>%t@ Please report upstream, ^^@]" t)
174174
~name:"Internal Error" ()
175175

176176
let uncaught_exn =

0 commit comments

Comments
 (0)