Skip to content

Hover and completion on an applied functor show the functor body's types #9072

Description

@cknitt

For a module created by applying a functor, hover and completion show the types of the functor's body instead of the applied signature:

module MakeSet = (O: Ord) => {
  type t = array<O.t>
  let add = (s: t, x: O.t) => s->Array.concat([x])
}
module IntSet = MakeSet({
  type t = int
  let compare = (a: int, b) => a - b
})
let s = IntSet.add([], 1)
//             ^ hover
// let s2 = IntSet.
//                 ^ completion

Hover on IntSet.add shows type IntSet.t = array<O.t>, and completion of IntSet. shows add: (t, O.t) => array<O.t>. The compiler's signature is type t = array<int> and let add: (t, int) => array<int>.

for_module in analysis/src/process_cmt.ml handles Tmod_apply by recursing into the functor's own module expression and ignores the argument.

Activity

  1. added theissue type on Oct 27, 2026
  2. added a commit that references this issue on Oct 28, 2026
    cd32c86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions