Skip to content

Commit

Permalink
Merge pull request #435 from mrjazzybread/bugfix
Browse files Browse the repository at this point in the history
Fix bug in creation of fresh type variables
  • Loading branch information
n-osborne authored Jan 20, 2025
2 parents 89b4e73 + 65c41f0 commit 46d1459
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
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) *)

0 comments on commit 46d1459

Please sign in to comment.