Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in creation of fresh type variables #435

Merged
merged 3 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@

## Internals

- Fix bug in creation of fresh type variables
[\#435](https://github.com/ocaml-gospel/gospel/pull/435)
- Fix premature parsing of specification keywords in the preprocessor.
[\#394](https://github.com/ocaml-gospel/gospel/pull/394)
- Fix `ls_name` of `unit` logical symbol to be `()`
Expand Down
2 changes: 1 addition & 1 deletion src/dterm.ml
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ let ts_of_dty = function Some dt_dty -> ts_of_dty dt_dty | None -> ts_bool
let rec ty_of_dty_raw = function
| Tvar { dtv_def = Some (Tty ty); _ } -> ty
| Tvar { dtv_def = Some dty; _ } -> ty_of_dty_raw dty
| Tvar _ -> fresh_ty_var ~loc:Location.none "xi"
| Tvar _ as ty -> ty_of_dty ty
| Tapp (ts, dl) -> ty_app ts (List.map ty_of_dty_raw dl)
| Tty ty -> ty

Expand Down
21 changes: 21 additions & 0 deletions test/typechecker/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,27 @@
(with-accepted-exit-codes 2
(run ocamlc -c %{dep:type_arity5.mli})))))

(rule
(deps
%{bin:gospel}
(:checker %{project_root}/test/utils/testchecker.exe))
(targets type_vars.gospel)
(action
(with-outputs-to type_vars.mli.output
(run %{checker} %{dep:type_vars.mli}))))

(rule
(alias runtest)
(action
(diff type_vars.mli type_vars.mli.output)))

(rule
(alias test-cmis)
(action
(chdir %{project_root}
; Syntax sanity check
(run ocamlc -c %{dep:type_vars.mli}))))

(rule
(deps
%{bin:gospel}
Expand Down
3 changes: 3 additions & 0 deletions test/typechecker/type_vars.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(*@ function f (f : 'a -> 'b) : 'a * 'b *)

(*@ axiom test1 : forall x. f (fun _ -> x) = (x, x) *)
Loading