Skip to content

Commit

Permalink
Fix Scala 2.13.1 integration (#196)
Browse files Browse the repository at this point in the history
Fix Scala 2.13.1 integration
  • Loading branch information
olafurpg authored Oct 14, 2019
2 parents 908f569 + 6b3fc62 commit a9529f2
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Scalafmt
script: ./bin/scalafmt --test
- env: Scala 2.13
script: sbt "++2.13.0 test"
script: sbt "++2.13.1 test"
- env: Scala 2.12
script: sbt test plugin/scripted
- env: Scala 2.11
Expand All @@ -36,4 +36,3 @@ before_cache:
- find $HOME/.sbt -name "*.lock" -type f -delete
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -type f -delete
- rm -rf $HOME/.ivy2/local

4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
def scala212 = "2.12.9"
def scala212 = "2.12.10"
def scala211 = "2.11.12"
def scala213 = "2.13.0"
def scala213 = "2.13.1"
inThisBuild(
List(
scalaVersion := scala212,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package mdoc.internal.markdown

import scala.tools.nsc.Settings
import scala.tools.nsc.reporters.AbstractReporter
import scala.reflect.internal.util.Position

trait VersionSpecificFilteringReporter extends AbstractReporter { self: FilterStoreReporter =>
override def display(pos: Position, msg: String, severity: Severity): Unit =
add(pos, msg, severity)
override def displayPrompt(): Unit = ()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package mdoc.internal.markdown

import scala.tools.nsc.Settings
import scala.tools.nsc.reporters.AbstractReporter
import scala.reflect.internal.util.Position

trait VersionSpecificFilteringReporter extends AbstractReporter { self: FilterStoreReporter =>
override def display(pos: Position, msg: String, severity: Severity): Unit =
add(pos, msg, severity)
override def displayPrompt(): Unit = ()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package mdoc.internal.markdown

import scala.tools.nsc.Settings
import scala.tools.nsc.reporters.FilteringReporter
import scala.reflect.internal.util.Position

trait VersionSpecificFilteringReporter extends FilteringReporter { self: FilterStoreReporter =>
override def doReport(pos: Position, msg: String, severity: Severity): Unit =
add(pos, msg, severity)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@ package mdoc.internal.markdown

import scala.collection.mutable
import scala.tools.nsc.Settings
import scala.tools.nsc.reporters.AbstractReporter
import scala.reflect.internal.util.Position

/** Same as nsc StoreReporter except it extends AbstractReporter.
*
* The AbstractReporter does filtering based on position to avoid duplicate diagnostics.
*/
class FilterStoreReporter(val settings: Settings) extends AbstractReporter {
class FilterStoreReporter(val settings: Settings) extends VersionSpecificFilteringReporter {
case class Info(pos: Position, msg: String, severity: Severity) {
override def toString() = s"pos: $pos $msg $severity"
}
val infos = new mutable.LinkedHashSet[Info]
override def display(pos: Position, msg: String, severity: Severity): Unit = {
protected def add(pos: Position, msg: String, severity: Severity): Unit = {
infos += Info(pos, msg, severity)
}
override def reset(): Unit = {
super.reset()
infos.clear()
}
override def displayPrompt(): Unit = ()
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class MarkdownCompiler(
val msg = nullableMessage(msgOrNull)
val mpos = toMetaPosition(edit, pos)
if (sectionPos.contains(mpos) || gseverity == sreporter.ERROR) {
val severity = gseverity.toString().toLowerCase
val severity = gseverity.toString.toLowerCase
val formatted = PositionSyntax.formatMessage(mpos, severity, msg, includePath = false)
ps.println(formatted)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/src/test/scala/tests/markdown/AsyncSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class AsyncSuite extends BaseMarkdownSuite {
|Caused by: java.util.concurrent.TimeoutException: Future timed out after [10 milliseconds]
| at scala.concurrent.impl.Promise$DefaultPromise.tryAwait0(Promise.scala:212)
| at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:225)
| at scala.concurrent.Await$.$anonfun$result$1(package.scala:200)
| at scala.concurrent.Await$.$anonfun$result$1(package.scala:201)
| at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:62)
| at scala.concurrent.Await$.result(package.scala:124)
| at repl.Session$App$.<clinit>(timeout.md:11)
Expand Down

0 comments on commit a9529f2

Please sign in to comment.