scala-cli
scala-cli copied to clipboard
Broken compilation when script name equals to library name
Version(s) 1.6.1, 1.7.1
Describe the bug In worksheet mode filename affects compilation.
To Reproduce
- Create file
zio.scwith code:
//> using dep "dev.zio::zio:2.1.16"
import zio.ZIO
- Run:
scala-cli zio.sc
Got:
[error] ./zio.sc:4:12
[error] value ZIO is not a member of zio$_
[error] import zio.ZIO
[error] ^^^
Expected behaviour
No compiler errors.
In non-worksheet mode (if filename is zio.scala) the behavior is as expected.
We will likely not be able to fix this use case fully, as it'd break other stuff. For a full explanation, see the discussion under @yadavan88's draft PR:
- https://github.com/VirtusLab/scala-cli/pull/3647#issuecomment-2838015070
However, the window is open for adding workarounds/doing UX improvements. I will leave the issue open for now.