fix: lake: report a missing library root file - #14625
Conversation
This PR makes Lake report the real error when a `lean_lib` root module has no source file. Building `lean_lib A` with only `A/One.lean` and no `A.lean` reported `A: some modules have bad imports` and discarded the real error, `no such file or directory: A.lean`. `LeanLib.recCollectLocalModules` dropped the module from the library's module set, so Lake never built it and never reported its error. The comment there says the error surfaces later when the module is built. That holds for a module reached through an import, which `collectImportsAux` reports against the importer, but not for one from `getModuleArray`, which has no importer. Lake now keeps such modules and still drops imported ones, so no second error appears where the importer already reports one. Closes leanprover#14619
ac83cb5 to
c12a117
Compare
|
Two calls I'm not sure about: Summary line. Location. #14619 points 1–2 suggest Note: a declared module with no source now sits in the module set, so |
|
Mathlib CI status (docs):
|
|
Reference manual CI status:
|
tydeu
left a comment
There was a problem hiding this comment.
This looks good overall! However, the error message in recCollectLocalModules needs to be updated to cover both cases. I think it should be kept, as it serves as a good summary when there are multiple errors with roots.
I am not sure what the best message would be. Maybe something like "some modules have bad imports or could not be found". Feel free to suggest something better!
|
@tydeu I added a "... could not be read" to the error message. I also changed the new variable name from |
This PR makes Lake report the underlying file error when a
lean_libroot module has no source file, instead of only reporting that some modules have bad imports.LeanLib.recCollectLocalModulesnow retains failed modules reached directly fromgetModuleArrayso their build jobs expose the error, while continuing to omit failures reached through imports because their importers report them.Closes #14619