REPL not sufficiently isolated from class artifacts in current directory
See original GitHub issueCompiler version
3.0.0
Minimized code
➜ snips scala oq.scala
2
0
➜ snips
➜ snips scalac -version
Scala compiler version 3.0.0 -- Copyright 2002-2021, LAMP/EPFL
➜ snips rm *.class *.tasty
➜ snips scala oq.scala
2
2
Output
This should never happen:
➜ snips vi hi.scala
➜ snips cat hi.scala
@main def test() = println("hello, world")
➜ snips scala hi.scala
hello, world
➜ snips scalac hi.scala
➜ snips vi hi.scala
➜ snips scala hi.scala
hello, world
➜ snips cat hi.scala
@main def test() = println("goodbye, cruel world")
➜ snips
Expectation
Running a script or interactive REPL actually runs the source text.
This is a follow-up to https://github.com/lampepfl/dotty/issues/7635 which was improperly closed.
Noticed again at https://gitter.im/scala/scala?at=60a9b889850bfa2d3bdaae09
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:22 (13 by maintainers)
Top Results From Across the Web
Expired artifacts still taking disk space (#346261) - GitLab.org
No artifact should ever be stored for more than a week. Build artifacts seem to expire correctly, but sometimes they are not removed...
Read more >Building applications with Maven - Quarkus
The project is generated in a directory named after the passed artifactId. ... Adding extension io.quarkus:quarkus-agroal ❌ Cannot find a dependency ...
Read more >The Bazel Code Base
The exec root, a directory that contains symlinks to all the source code for the current build. It's located at $OUTPUT_BASE/execroot .
Read more >Working with artifacts | Freddys blog
In the US folder you will find a manifest.json + all the things that ... If the container was started using a docker...
Read more >Learning the Basics - Gradle User Manual
Gradle provides sufficient tooling to visualize, navigate and analyze the ... flat directory repositories cannot be used to override artifacts with real ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
PR: #14021 (yes, that hypothesis was the way forward)
The King James Bible (1611) also spells it “subtil”. Most famously in Genesis: “the serpent was more subtil than any beast of the field…”
Dale and I spent about two hours looking at this today and we learned some things but don’t really have a solution in sight yet. But both of us want to keep working on it, both for the importance of the bug itself, and because it’s good learning and good saw-sharpening.
Some of the code we were studying:
ReplCompiler#newRun
is where each new thing entered in the REPL gets access to the bindings established earlier in the session; a fold repeatedly callsimportPreviousRun
, which doesctx.fresh
and.withRootImports(RootRef(() => requiredModuleRef(path)) :: Nil)
wherepath
is successivelyrepl.rs$line$1
,repl.rs$line$2
, and so on. (Therepl.
part was added by Tom in #12607.)References to names are resolved in
Typer
byfindRef
which callsfindRefRecur
which callscheckNewOrShadowed
, which seems relevant and perhaps if we studied it (and/or added logging and/or stepped through it in a debugger) we’d have an aha moment.At the broadest level, we still don’t know:
def
orval
is entered?def
orval
?We sort of circled around between these three possibilities, dipping shallowly into each one, without committing yet to truly proving or disproving a particular one.
Dale has a WIP branch with some added logging (but those logs have yet to produce a smoking gun).