$file doesn't work correctly when run from ammonite predef file #616
Comments
Specifically, the issue is the imports in the respective predef file are meant to be automatically propagated to the REPL/scripts, but I guess the logic around the ImportHooks in the predef isn't doing it correctly so the magic-imported ImportHook imports are generally handled via a different code-path from "normal" imports and other declarations, so we probably just forgot to take the ImportHook imports coming from the various predefs and plumb them into the right place |
Fixed by 49e007d |
Fixed in the latest unstable lihaoyi Ammonite$ cat ~/.ammonite/predef.sc
import $file.foo
lihaoyi Ammonite$ cat ~/.ammonite/foo.sc
val bar = 1337
lihaoyi Ammonite$ amm
Loading...
Welcome to the Ammonite Repl 49e007d
(Scala 2.12.2 Java 1.8.0_112)
If you like Ammonite, please support our development at www.patreon.com/lihaoyi
@ foo.bar
res0: Int = 1337 |
lihaoyi
added a commit
that referenced
this issue
May 29, 2017
Now the files imported by `predef.sc` will all be sandboxed within the `ammonite.predef` package, and kept separate from "normally" imported files which end up in the `$file` package. This fixes an issue that appeared when #616 was fixed, where the files imported from your predef would end up at different package paths depending on what your `pwd` is, resulting in the cached scripts not lining up with the real package structure
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As in the title:
The text was updated successfully, but these errors were encountered: