feat: add requiresModuleSystem package option in Lake#13646
Draft
Kha wants to merge 2 commits into
Draft
Conversation
This PR adds a new package configuration option `requiresModuleSystem`. When a package sets it to `true`, Lake emits a warning whenever a module from another package imports any of its modules without itself using the module system (i.e., without a `module` header). This lets package authors signal that their API is designed for the visibility and elaboration semantics of the module system. The check lives in `fetchImportInfo` and runs once per import after resolving the providing module(s); the disambiguation case (multiple packages providing the same module name) warns if any provider has the flag set.
Collaborator
|
Reference manual CI status:
|
|
Mathlib CI status (docs):
|
This PR adds a companion configuration option `silenceRequiresModuleSystemWarning` that lets a package opt out of the warning emitted by Lake when it imports modules from a `requiresModuleSystem` dependency without using the module system. This is intended for packages that have knowingly decided not to migrate to the module system yet. The flag is honored by `fetchImportInfo` via a new `silenceWarning` parameter threaded from the importing module's package configuration.
mathlib-nightly-testing Bot
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
May 6, 2026
mathlib-nightly-testing Bot
pushed a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a new Lake package option
requiresModuleSystem. When a package sets it totrue, Lake emits a warning whenever a non-module-system file (one without amoduleheader) imports a module of the package, both from downstream consumers and from non-module files within the package itself. This signals that the package's API expects the visibility and elaboration semantics of the module system. A companion optionallowNonModuleslets an importing package opt out of these warnings, declaring that it knowingly mixes non-module-system files with module-system dependencies.