mill
mill copied to clipboard
In Mill 0.11.x, importing from a $file in folder is ambiguous when filename matches extracted attribute
I've been looking at migrating us from Mill 0.10.12 to 0.11.5. I see there are some breaking changes in the release notes. Regarding $file
, I figured we have some fairly standard foreign module imports (rather than meta builds) but came across an error a bit similar to https://github.com/com-lihaoyi/mill/issues/2683 - ambiguous import
.
I have put a few commits onto a fork of mill here, in the import file example (amazing to have, thanks!). In summary:
-
import $file.scalaversion, scalaversion.scalaversion
is OK ✅ -
import $file.modules.broken, broken.broken
is not OK 🚫-
reference to broken is ambiguous; it is imported twice in the same scope ...
- This worked OK in Mill 0.10.x
-
I am wondering if this is a bug. Why is it only ambiguous when the foreign module is inside some folder (modules
)?
I see that in the meantime, one can 1. rename the files (e.g. prefix _
), or 2. rename ambiguous imports (as suggested here).
The error, for searchability:
[error] /Users/james/code/mill/example/misc/3-import-file-ivy/build.sc:10:22: reference to broken is ambiguous;
[error] it is imported twice in the same scope by
[error] import broken.broken
[error] and import millbuild.modules.broken
[error] println(s"broken: $broken")
[error] ^
[error] one error found
1 targets failed
compile Compilation failed