You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace import $file syntax with flat package namespacing (#4462)
Fixes#4459Fixes#3894
With this PR, all `.mill` files in a folder are in the same flat
`package` namespace, similar to how normal Scala files work. The
previous `import $file` syntax was inherited from Ammonite, and
unfortunately never took off across the Scala community. In effect this
makes `.mill` files behave almost exactly like `.scala` files, which is
part of the longer term goal of removing special handling for `.mill`
files.
The code generation for the helper files is not changed at all in this
PR, rather we just make use of Scala 3's `export` clauses to make them
available under the main `build.mill`/`package.mill` file as well
There is the caveat that the `package object`s in `.mill` files can be
referenced via `build.foo.bar` without the trailing `.package`.
Implementing this caveat is the cause of a lot of the hackiness in the
codegen, which will hopefully go away once the upstream language feature
lands scala/improvement-proposals#100
We leave the codegenned `import _root_.{build_ => $file}` in place so
`import $file` will continue to work to ease in the migration, but are
no longer the recommended way of referencing helper files
0 commit comments