Skip to content

Commit

Permalink
Bump Scala version 2.13.2 (#1065)
Browse files Browse the repository at this point in the history
* wip

* bump jline

* bump travis version

* long lines

* fixes

* .
  • Loading branch information
lihaoyi authored Apr 24, 2020
1 parent d723a93 commit 5d83709
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ matrix:
- stage: build
env: CI_SCRIPT="./mill -i unitTest"
jdk: oraclejdk8
scala: 2.13.1
scala: 2.13.2

- stage: build
env: CI_SCRIPT="./mill -i integrationTest"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package ammonite.interp

import ammonite.runtime.Classpath

import scala.reflect.internal.util.Position
import scala.reflect.io.FileZipArchive
import scala.tools.nsc
import scala.tools.nsc.classpath.{AggregateClassPath, ZipAndJarClassPathFactory}
import scala.tools.nsc.{Global, Settings}
import scala.tools.nsc.interactive.{InteractiveAnalyzer, Global => InteractiveGlobal}
import scala.tools.nsc.plugins.Plugin
import scala.tools.nsc.reporters.FilteringReporter
import scala.tools.nsc.typechecker.Analyzer

object MakeReporter {

type Reporter = scala.tools.nsc.reporters.Reporter

def makeReporter(errorLogger: (Position, String) => Unit,
warningLogger: (Position, String) => Unit,
infoLogger: (Position, String) => Unit,
outerSettings: Settings): Reporter =
new FilteringReporter {

def doReport(pos: scala.reflect.internal.util.Position,
msg: String,
severity: Severity): Unit =
display(pos, msg, severity)

def display(pos: Position, msg: String, severity: Severity) =
severity match{
case ERROR =>
Classpath.traceClasspathProblem(s"ERROR: $msg")
errorLogger(pos, msg)
case WARNING =>
warningLogger(pos, msg)
case INFO =>
infoLogger(pos, msg)
}

def settings = outerSettings
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class AmmoniteBuildServer(
Dependency.of(
"org.scalameta",
"semanticdb-scalac_" + scala.util.Properties.versionNumberString,
"4.3.7"
"4.3.9"
)
),
root,
Expand Down
5 changes: 3 additions & 2 deletions amm/repl/api/src/main/scala/ammonite/repl/tools/Router.scala
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,9 @@ class Router [C <: Context](val c: C) {
if (curCls.members.exists(_.name.toString == defaultName)) Some(defaultName)
else None
}
val argListSymbol = q"${c.fresh[TermName]("argsList")}"
val extrasSymbol = q"${c.fresh[TermName]("extras")}"

val argListSymbol = q"${c.fresh[TermName](TermName("argsList"))}"
val extrasSymbol = q"${c.fresh[TermName](TermName("extras"))}"
val defaults = for ((arg, i) <- flattenedArgLists.zipWithIndex) yield {
val arg = TermName(c.freshName())
hasDefault(i).map(defaultName => q"($arg: $curCls) => $arg.${newTermName(defaultName)}")
Expand Down
21 changes: 11 additions & 10 deletions amm/repl/src/main/scala/ammonite/repl/FrontEnds.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import fastparse.Parsed
import fastparse.ParserInput
import org.jline.reader.{Highlighter => _, _}
import org.jline.reader.impl.history.DefaultHistory
import org.jline.reader.impl.DefaultParser.ArgumentList

import org.jline.terminal._
import org.jline.utils.AttributedString
import ammonite.util.{Catching, Colors, Res}
import ammonite.repl.api.FrontEnd
import ammonite.interp.{Parsers, Preprocessor}
import org.jline.reader.impl.DefaultParser


object FrontEnds {
Expand Down Expand Up @@ -55,7 +56,7 @@ object FrontEnds {
def readCode(): Res[(String, Seq[String])] = {
Option(reader.readLine(prompt)) match {
case Some(code) =>
val pl = reader.getParser.parse(code, 0).asInstanceOf[AmmoniteParsedLine]
val pl = reader.getParser.parse(code, 0).asInstanceOf[AmmParser#AmmoniteParsedLine]
Res.Success(code -> pl.stmts)
case None => Res.Exit(())
}
Expand Down Expand Up @@ -125,10 +126,15 @@ class AmmCompleter(highlighter: org.jline.reader.Highlighter) extends Completer
}

class AmmParser extends Parser {
class AmmoniteParsedLine(line: String, words: java.util.List[String],
wordIndex: Int, wordCursor: Int, cursor: Int,
val stmts: Seq[String] = Seq.empty // needed for interpreter
)
extends defaultParser.ArgumentList(line, words, wordIndex, wordCursor, cursor)

var addHistory: String => Unit = x => ()

private val defaultParser = new org.jline.reader.impl.DefaultParser
val defaultParser = new org.jline.reader.impl.DefaultParser

override def parse(line: String, cursor: Int, context: Parser.ParseContext): ParsedLine = {
// let JLine's default parser to handle JLine words and indices
Expand Down Expand Up @@ -169,18 +175,13 @@ class AmmParser extends Parser {
}
}

class AmmoniteParsedLine(
line: String, words: java.util.List[String],
wordIndex: Int, wordCursor: Int, cursor: Int,
val stmts: Seq[String] = Seq.empty // needed for interpreter
) extends ArgumentList(line, words, wordIndex, wordCursor, cursor)

class SyntaxError(val msg: String) extends RuntimeException

class AmmHighlighter extends org.jline.reader.Highlighter {

var colors: Colors = Colors.Default

def setErrorIndex(x$1: Int): Unit = ()
def setErrorPattern(x$1: java.util.regex.Pattern): Unit = ()
override def highlight(reader: LineReader, buffer: String): AttributedString = {
val hl = Highlighter.defaultHighlight(
buffer.toVector,
Expand Down
18 changes: 9 additions & 9 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ val commitsSinceTaggedVersion = {
}


val binCrossScalaVersions = Seq("2.12.11", "2.13.1")
val isScala2_12_10OrLater = Set("2.12.10") ++ binCrossScalaVersions
val binCrossScalaVersions = Seq("2.12.11", "2.13.2")
val isScala2_12_10OrLater = Set("2.12.10", "2.12.11", "2.13.1", "2.13.2")
val fullCrossScalaVersions = Seq(
"2.12.1", "2.12.2", "2.12.3", "2.12.4", "2.12.6", "2.12.7", "2.12.8", "2.12.9", "2.12.10", "2.12.11",
"2.13.0", "2.13.1"
"2.13.0", "2.13.1", "2.13.2"
)

val latestAssemblies = binCrossScalaVersions.map(amm(_).assembly)
Expand Down Expand Up @@ -68,8 +68,8 @@ trait AmmInternalModule extends mill.scalalib.CrossSbtModule{
else millSourcePath / "src" / "main" / "scala-not-2.12.10-2.13.1+"
)
val extraDir3 =
if (sv == "2.13.1") Nil
else Seq(PathRef(millSourcePath / "src" / "main" / "scala-not-2.13.1"))
if (sv == "2.13.1" || sv == "2.13.2") Nil
else Seq(PathRef(millSourcePath / "src" / "main" / "scala-not-2.13.1+"))

super.sources() ++ extraDir ++ Seq(extraDir2) ++ extraDir3
}
Expand Down Expand Up @@ -147,7 +147,7 @@ class OpsModule(val crossScalaVersion: String) extends AmmModule{
object terminal extends Cross[TerminalModule](binCrossScalaVersions:_*)
class TerminalModule(val crossScalaVersion: String) extends AmmModule{
def ivyDeps = Agg(
ivy"com.lihaoyi::sourcecode:0.2.0",
ivy"com.lihaoyi::sourcecode:0.2.1",
ivy"com.lihaoyi::fansi:0.2.8"
)
def compileIvyDeps = Agg(
Expand Down Expand Up @@ -249,9 +249,9 @@ object amm extends Cross[MainModule](fullCrossScalaVersions:_*){
terminal()
)
def ivyDeps = Agg(
ivy"org.jline:jline-terminal:3.6.2",
ivy"org.jline:jline-terminal-jna:3.6.2",
ivy"org.jline:jline-reader:3.6.2",
ivy"org.jline:jline-terminal:3.14.1",
ivy"org.jline:jline-terminal-jna:3.14.1",
ivy"org.jline:jline-reader:3.14.1",
ivy"com.github.javaparser:javaparser-core:3.2.5",
ivy"com.github.scopt::scopt:3.7.1"
)
Expand Down
2 changes: 1 addition & 1 deletion mill
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This is a wrapper script, that automatically download mill from GitHub release pages
# You can give the required mill version with MILL_VERSION env variable
# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION
DEFAULT_MILL_VERSION=0.6.1-122-5be570
DEFAULT_MILL_VERSION=0.6.2

set -e

Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,4 @@ And possibly:
- **It's entirely possible your changes won't be merged**, or will get ripped out later. This is also the case for my changes, as the Author!
- **Even a rejected/reverted PR is valuable**! It helps to explore the solution space, and know what works and what doesn't. For every line in the repo, at least three lines were tried, committed, and reverted/refactored, and more than 10 were tried without committing.
- **Feel free to send Proof-Of-Concept PRs** that you don't intend to get merged.

0 comments on commit 5d83709

Please sign in to comment.