Skip to content

Improve error message when non-functor used as functor #13702

Closed

Description

@yallop

#12224 improved the error message issued when a non-functor occurs in an applicand position. It would be good to similarly improve the error message when a non-functor appears in other places where a functor is expected (e.g. as an argument or in an ascription), e.g.:

# module F : sig end -> sig end = struct end;;
Line 1, characters 32-42:
1 | module F : sig end -> sig end = struct end;;
                                    ^^^^^^^^^^
Error: Signature mismatch:
       Modules do not match:  -> ... is not included in (sig end) -> ...
       An argument appears to be missing with module type sig end

Activity

  1. added a commit that references this issue on Mar 21, 2025
  2. Octachron commented on Mar 21, 2025

    @Octachron
    Member

    This was fixed by #13865, the error message is now specialized to

    Error: Signature mismatch:
           This module should not be a structure, a functor was expected.

    The reverse case is also handled with a hint about missing arguments (or incompatible module types).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions