diff --git a/.travis.yml b/.travis.yml index 5f0e95c5..a84fbe65 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,10 @@ import: scala/scala-dev:travis/default.yml language: scala scala: - - 3.0.0-M1 + - 3.0.0-M2 - 2.11.12 - 2.12.12 - - 2.13.3 + - 2.13.4 env: - ADOPTOPENJDK=8 SCALAJS_VERSION= @@ -16,9 +16,6 @@ env: - ADOPTOPENJDK=11 SCALAJS_VERSION= matrix: - exclude: - - scala: 3.0.0-M1 - env: ADOPTOPENJDK=8 SCALAJS_VERSION=1.3.1 include: - scala: 2.11.12 env: ADOPTOPENJDK=8 SCALANATIVE_VERSION=0.3.9 diff --git a/build.sbt b/build.sbt index dc331943..ab6e6404 100644 --- a/build.sbt +++ b/build.sbt @@ -13,6 +13,9 @@ lazy val parserCombinators = crossProject(JVMPlatform, JSPlatform, NativePlatfor libraryDependencies += "junit" % "junit" % "4.13.1" % Test, libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, + // so we can `@nowarn` in test code, but only in test code, so the dependency + // doesn't leak downstream + libraryDependencies += "org.scala-lang.modules" %% "scala-collection-compat" % "2.3.1" % Test, apiMappings ++= scalaInstance.value.libraryJars.collect { case file if file.getName.startsWith("scala-library") && file.getName.endsWith(".jar") => diff --git a/shared/src/main/scala/scala/util/parsing/combinator/PackratParsers.scala b/shared/src/main/scala/scala/util/parsing/combinator/PackratParsers.scala index 23a492d8..8db59f1d 100644 --- a/shared/src/main/scala/scala/util/parsing/combinator/PackratParsers.scala +++ b/shared/src/main/scala/scala/util/parsing/combinator/PackratParsers.scala @@ -211,7 +211,7 @@ to update each parser involved in the recursion. case LR(seed ,rule, Some(head)) => if(head.getHead != p) /*not head rule, so not growing*/ seed.asInstanceOf[ParseResult[T]] else { - in.updateCacheAndGet(p, MemoEntry(Right[LR, ParseResult[T]](seed.asInstanceOf[ParseResult[T]]))) + in.updateCacheAndGet(p, MemoEntry(Right(seed.asInstanceOf[ParseResult[T]]))) seed match { case f@Failure(_,_) => f case e@Error(_,_) => e diff --git a/shared/src/main/scala/scala/util/parsing/combinator/Parsers.scala b/shared/src/main/scala/scala/util/parsing/combinator/Parsers.scala index 35ee15e6..fbb712e7 100644 --- a/shared/src/main/scala/scala/util/parsing/combinator/Parsers.scala +++ b/shared/src/main/scala/scala/util/parsing/combinator/Parsers.scala @@ -403,7 +403,9 @@ trait Parsers { val res1 = Parser.this(in) val res2 = q(in) - (res1, res2) match { + // compiler thinks match isn't exhaustive; perhaps it's right, but does that mean there's a bug here? + // that's not clear to me, so for now let's just `@unchecked` it + ((res1, res2): @unchecked) match { case (s1 @ Success(_, next1), s2 @ Success(_, next2)) => if (next2.pos < next1.pos || next2.pos == next1.pos) s1 else s2 case (s1 @ Success(_, _), _) => s1 case (_, s2 @ Success(_, _)) => s2 diff --git a/shared/src/test/scala/scala/util/parsing/combinator/PackratParsersTest.scala b/shared/src/test/scala/scala/util/parsing/combinator/PackratParsersTest.scala index f95d45ec..6c9e28e2 100644 --- a/shared/src/test/scala/scala/util/parsing/combinator/PackratParsersTest.scala +++ b/shared/src/test/scala/scala/util/parsing/combinator/PackratParsersTest.scala @@ -190,7 +190,8 @@ private object grammars3 extends StandardTokenParsers with PackratParsers { | success(Nil) ) + @annotation.nowarn // Some(xs) in pattern isn't exhaustive def repMany1[T](p: => Parser[T], q: => Parser[T]): Parser[List[T]] = - p~opt(repMany(p,q))~q ^^ {case x~Some(xs)~y => x::xs:::(y::Nil)} + p~opt(repMany(p,q))~q ^^ {case x~Some(xs)~y => x::xs:::(y::Nil)} }