Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module constraints involving functors are not handled properly in the upper layers #19984

Open
ppedrot opened this issue Jan 6, 2025 · 0 comments
Labels
kind: bug An error, flaw, fault or unintended behaviour. part: modules The module system of Coq.

Comments

@ppedrot
Copy link
Member

ppedrot commented Jan 6, 2025

Description of the problem

The kernel supports instantiating a functor with a body in a type through the with Module construct, but the upper layers seemingly do not. Incidentally we do not have any test for higher-order module constraint in the test-suite.

Small Rocq / Coq file to reproduce the bug

Module Type S. End S.

Module N. End N.

Module Type T.

Declare Module F(X : S) : S.

End T.

Module F0 (X : S).
Definition n := 2. (* dummy value to sanity-check subtyping *)
End F0.

(* This works, note the <: *)

Module M_ok <: T with Module F := F0.

Module F(X : S).
Definition m := 1.
Definition n := m + m.
End F.

End M_ok.

Module FF_ok := M_ok.F.
Module MM_ok := FF_ok(N).

(* This does not after sealing *)

Module M_ko : T with Module F := F0.

Module F(X : S).
Definition m := 1.
Definition n := m + m.
End F.

End M_ko.

Module FF_ko := M_ko.F.
Module MM_ko := FF_ko(N). (* Error: Application of a functor with too few arguments. *)

Version of Rocq / Coq where this bug occurs

No response

Last version of Rocq / Coq where the bug did not occur

No response

@ppedrot ppedrot added kind: bug An error, flaw, fault or unintended behaviour. needs: triage The validity of this issue needs to be checked, or the issue itself updated. part: modules The module system of Coq. and removed needs: triage The validity of this issue needs to be checked, or the issue itself updated. labels Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug An error, flaw, fault or unintended behaviour. part: modules The module system of Coq.
Projects
None yet
Development

No branches or pull requests

1 participant