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

Add stub mill.define.Ctx to trick IntelliJ into not erroring #3856

Merged
merged 9 commits into from
Oct 29, 2024

Conversation

lihaoyi
Copy link
Member

@lihaoyi lihaoyi commented Oct 28, 2024

Same as #3558, but for mill.define.Ctx rather than mill.main.RootModule.Info. Because it's provided by the enclosing code-generation, we need to trick IntelliJ into thinking there is something it can use, and so I define a low priority implicit to fall back upon if the main def make doesn't work (but @compileTimeOnly to show an error message if it ends up being needed)

I moved the bulk of the cacher logic from mill-moduledefs to mill.define. We just need a marker trait in mill-moduledefs, and having the rest of the logic in Mill itself simplifies maintenance and evolution of the code

Before
Screenshot 2024-10-28 at 5 55 39 PM

After
Screenshot 2024-10-28 at 5 54 22 PM

assert(e.msg.contains(
"Modules and Tasks can only be defined within a mill Module"
"Task{} members must be defs defined in a Cacher class/trait/object body"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Cacher never surfaces in our docs (and API), we probably should list the most likely candidate Module.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Task{} members must be defs defined in a Cacher class/trait/object body"
"Task{} members must be defs defined in a Cacher class/trait/object body like Module"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually comes from the mill-moduledefs repo, so we'll need to fix it upstream there https://github.com/com-lihaoyi/mill-moduledefs/blob/33a27d470a8f27a1cb2ad9e71d8c25b24294eee8/moduledefs/src-2/Cacher.scala#L29

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lihaoyi lihaoyi merged commit 345f5a5 into com-lihaoyi:main Oct 29, 2024
24 checks passed
@lefou lefou added this to the 0.12.2 milestone Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants