Skip to content

The REPL stopped reading classfiles from the current working directory #16715

Closed as not planned
@julienrf

Description

@julienrf

Compiler version

Regression appeared in 3.1.0.

Minimized code

First, I create a file and I compile it in the current directory.

echo 'class Foo' > Foo.scala
cs launch scalac:3.0.0 -- Foo.scala

Then:

/tmp/scala3-3.1.0/bin/scala
Welcome to Scala 3.1.0 (17.0.4, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                         
scala> new Foo()
-- Error:
1 |new Foo()
  |    ^^^
  |    Not found: type Foo

However, in Scala 3.0.2:

/tmp/scala3-3.0.2/bin/scala     
scala> new Foo()
val res0: Foo = Foo@71c0b742

Also note that if I run scala with cs launch scala:3.1.0 instead of using the binary published in the release, then it works as in 3.0.2.

Expectation

The current working directory should be included in the classpath, by default, as it was the case in 3.0.2, as it is the case in 2.13, and as it is documented:

/tmp/scala3-3.1.0/bin/scala --help
Usage: scala <options> <source files>
where possible standard options include:
[…]
-classpath            Specify where to find user class files.
                      Default: .

Related discussion: VirtusLab/scala-cli#1686

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions