ocaml-modular-implicits icon indicating copy to clipboard operation
ocaml-modular-implicits copied to clipboard

Assertion error with implicit of abstract module type

Open yallop opened this issue 11 years ago • 1 comments
trafficstars

# module F(X : sig module type T end) =
struct
  let f (implicit Y:X.T) () = ()
  let _ = f ()
end
;;
Fatal error: exception File "typing/implicitsearch.ml", line 400, characters 26-32: Assertion failed

yallop avatar Sep 17 '14 23:09 yallop

I don't know how to interpret search for an abstract module type. Of course, a clean error message should be provided. Or maybe there is a cleaner way of handling this case?

Maybe treating X.T path as a witness for a module type and searching for implicits in scope having this name as type?

This would allow:

module F(X : sig module type T module M : T end) =
struct
  let f (implicit Y:X.T) () = ()
  implicit module M = X.M
  let _ = f ()
end

let-def avatar Sep 18 '14 04:09 let-def