Skip to content

Commit

Permalink
Fix usage of applied functors behind signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
tjammer committed Oct 11, 2024
1 parent 9e43871 commit ab03153
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/module.ml
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,12 @@ let rec add_to_env env foreign (mname, m) =
if not (Hashtbl.mem tbl name) then
(* Add decl to table *)
Hashtbl.add tbl name decl
| Mapplied_functor (loc, key, p, m) -> (
(* [register_applied_functor] adds the types to the decl table
so they are readable later on *)
match register_applied_functor env loc key p m with
| Ok _ -> ()
| Error () -> raise (Error (loc, "Cannot apply functor")))
| _ -> ())
m.i;
env
Expand Down
4 changes: 3 additions & 1 deletion lib/monomorph_tree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ let rec cln ss p = function
| Dabstract (Some dkind) -> cln_dkind dkind
in
cln_dkind decl.kind
| None -> failwith "Internal Error: Tconstr not available")
| None ->
failwith
("Internal Error: Tconstr " ^ Path.show name ^ " not available"))

and cln_kind ss p = function
| Simple -> Simple
Expand Down
10 changes: 10 additions & 0 deletions test/modules.t/hidden_functor_app.smu
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
signature {
val do : () -> unit
}

module stbl = hashtbl/make(string)

fun do() {
let _ : stbl/t[int] = stbl/create(16)
()
}
3 changes: 3 additions & 0 deletions test/modules.t/use_hidden_functor_app.smu
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import hidden_functor_app

hidden_functor_app/do()

0 comments on commit ab03153

Please sign in to comment.