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

Can't load modules from modules #149

Closed
lihaoyi opened this Issue Aug 9, 2015 · 1 comment

Comments

Projects
None yet
1 participant
@lihaoyi
Owner

lihaoyi commented Aug 9, 2015

This doesn't seem to behave correctly in the following case:

// LimitImports.scala
val res = 1
@
val asd = 1
// Foo.scala
import ammonite.ops._

load.module(wd/"LimitImports.scala")

@

println(res)
println(asd)
@ // Repl Session
@ import ammonite.ops._
@ load.module(wd/"Foo.scala")
ammonite.repl.CompilationError: Compilation Failed
Main.scala:174: not found: value res
println(res)
        ^
Main.scala:177: not found: value asd
println(asd)
        ^
    ammonite.repl.interp.Interpreter.loop$1(Interpreter.scala:97)
    ammonite.repl.interp.Interpreter.processScript(Interpreter.scala:86)
    ammonite.repl.interp.Interpreter.processModule(Interpreter.scala:67)
    ammonite.repl.interp.Interpreter$$anon$1$load$.module(Interpreter.scala:134)
    cmd4$$anonfun$1.apply$mcV$sp(Main.scala:110)
    cmd4$.<init>(Main.scala:111)
    cmd4$.<clinit>(Main.scala:-1)

This should work. Will take some refactoring to make load.module put the imports in the right place depending on whether it's being called in a module or directly from the REPL, but shouldn't be hard in principle

@lihaoyi

This comment has been minimized.

Owner

lihaoyi commented Aug 9, 2015

@laci37 this is probably on you when you come back, since you own much of the module/script loading stuff =)

@lihaoyi lihaoyi added this to the 0.5.0 milestone Aug 16, 2015

@lihaoyi lihaoyi closed this Aug 23, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment