Open
Description
Compiler version
Scala compiler version 3.4.0-RC1-bin-SNAPSHOT-git-5454110
Minimized code
This behavior was previously fixed for REPL:
Welcome to Scala 3.4.0-RC1-bin-SNAPSHOT-git-5454110 (21, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala> class C { def f = 42 }
// defined class C
scala> new C().f
val res0: Int = 42
but
➜ snips cat noc.scala
class C { def f = 42 }
object Test extends App {
println(new C().f)
}
➜ snips ~/projects/dotty/bin/scala noc.scala
java.lang.NoSuchMethodError: 'int C.f()'
at Test$.<clinit>(noc.scala:5)
at Test.main(noc.scala)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at dotty.tools.scripting.ScriptingDriver.compileAndRun(ScriptingDriver.scala:33)
at dotty.tools.scripting.Main$.process(Main.scala:45)
at dotty.tools.MainGenericRunner$.run$1(MainGenericRunner.scala:250)
at dotty.tools.MainGenericRunner$.process(MainGenericRunner.scala:270)
at dotty.tools.MainGenericRunner$.main(MainGenericRunner.scala:281)
at dotty.tools.MainGenericRunner.main(MainGenericRunner.scala)
Output
D'oh! I must have been testing something a month ago. Nowadays, usually I only -d /tmp/sandbox
for this reason.
➜ snips ls -l C.*
-rw-r--r-- 1 amarki amarki 420 Oct 16 17:06 C.class
-rw-r--r-- 1 amarki amarki 534 Oct 16 17:06 C.tasty
Expectation
A class freshly compiled in the script should come first on the classpath.