Skip to content
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

Scala interpreter is not ignoring package statement #4768

Closed
scabug opened this issue Jul 5, 2011 · 2 comments
Closed

Scala interpreter is not ignoring package statement #4768

scabug opened this issue Jul 5, 2011 · 2 comments
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) scripting

Comments

@scabug
Copy link

scabug commented Jul 5, 2011

Running as script generates an error on package statement.
The interpreter should just ignore package statement (or use it internally if it is needed)

bar.scala (attachment)

package bar

object Bar extends App {
   println("test")
}
C:\scala-2.9.0.1\examples>scala bar.scala
C:\scala-2.9.0.1\examples\bar.scala:1: error: illegal start of definition
package bar
^
one error found
@scabug
Copy link
Author

scabug commented Jul 5, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4768?orig=1
Reporter: DaveScala (davescala)
Affected Versions: 2.9.0
Attachments:

  • bar.scala (created on Jul 5, 2011 12:18:58 PM UTC, 62 bytes)

@scabug scabug added this to the Backlog milestone Apr 7, 2017
@SethTisue SethTisue added scripting fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) and removed repl labels Feb 26, 2023
@SethTisue
Copy link
Member

SethTisue commented Feb 26, 2023

Scala 3 accepts it.

In Scala 2, if one tries this with scala-cli, scala-cli run accepts it for a .scala file, but rejects it for an .sc file.

The Scala 2 script runner is considered legacy and is slated to be replaced with scala-cli, so I'm going to close this. The old script runner won't cease to exist, but regardless, we shouldn't be looking to add new features to it.

@SethTisue SethTisue removed this from the Backlog milestone Feb 26, 2023
@SethTisue SethTisue closed this as not planned Won't fix, can't repro, duplicate, stale Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) scripting
Projects
None yet
Development

No branches or pull requests

2 participants