Skip to content

Commit

Permalink
Print correct Scala 3 version in welcome banner
Browse files Browse the repository at this point in the history
scala.util.Properties.versionNumberString still returns 2.13.x in Scala
3, so some extra logic is needed here.
  • Loading branch information
alexarchambault committed Feb 4, 2021
1 parent 5b1f8c9 commit 6a815b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions amm/repl/src/main/scala/ammonite/main/Defaults.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ object Defaults{

val welcomeBanner = {
def ammoniteVersion = ammonite.Constants.version
def scalaVersion = scala.util.Properties.versionNumberString
def javaVersion = System.getProperty("java.version")
Util.normalizeNewlines(
s"Welcome to the Ammonite Repl $ammoniteVersion (Scala $scalaVersion Java $javaVersion)"
s"Welcome to the Ammonite Repl $ammoniteVersion (Scala %SCALA_VERSION% Java $javaVersion)"
)
}

Expand Down
4 changes: 3 additions & 1 deletion amm/repl/src/main/scala/ammonite/repl/Repl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ class Repl(input: InputStream,


def run(): Any = {
welcomeBanner.foreach(printer.outStream.println)
welcomeBanner
.map(_.replace("%SCALA_VERSION%", compilerBuilder.scalaVersion))
.foreach(printer.outStream.println)
@tailrec def loop(): Any = {
val actionResult = action()
Repl.handleOutput(interp, actionResult)
Expand Down

0 comments on commit 6a815b0

Please sign in to comment.