Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,16 @@ lazy val parserCombinators = crossProject(JVMPlatform, JSPlatform, NativePlatfor
version.value
)
}),
Compile / unmanagedSourceDirectories ++= {
(Compile / unmanagedSourceDirectories).value.map { dir =>
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) => file(dir.getPath ++ "-2.13+")
case Some((3, _)) => file(dir.getPath ++ "-2.13+")
case _ => file(dir.getPath ++ "-2.13-")
}
}
},

mimaBinaryIssueFilters ++= {
Seq(
// scala/scala-parser-combinators#605
ProblemFilters.exclude[IncompatibleSignatureProblem]("scala.util.parsing.input.PagedSeq.sliding"),
// scala/scala-parser-combinators#646
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.util.parsing.combinator.Parsers#~.given_CanEqual_~_~"),
Comment thread
Philippus marked this conversation as resolved.
// -Yfuture-lazy-vals turns the module's <clinit> from public to private, which is not an
// incompatibility. Drop once the fix for scala-garden/mima#794 is released.
ProblemFilters.exclude[DirectMissingMethodProblem]("scala.util.parsing.input.OffsetPosition.<clinit>"),
)
},
)
Expand Down
1,040 changes: 1,040 additions & 0 deletions shared/src/main/scala-2.13/scala/util/parsing/combinator/Parsers.scala

Large diffs are not rendered by default.

1,044 changes: 1,044 additions & 0 deletions shared/src/main/scala-3/scala/util/parsing/combinator/Parsers.scala

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Scala (https://www.scala-lang.org)
*
* Copyright EPFL and Lightbend, Inc. dba Akka
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/

package scala.util.parsing.input

private[input] trait ScalaVersionSpecificPagedSeq[T] {
self: PagedSeq[T] =>
// Members declared in scala.collection.Seq
override def iterableFactory: collection.SeqFactory[collection.IndexedSeq] = collection.IndexedSeq

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Scala (https://www.scala-lang.org)
*
* Copyright EPFL and Lightbend, Inc. dba Akka
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/

package scala.util.parsing.combinator

import scala.language.strictEquality
import scala.util.parsing.combinator.RegexParsers

class CanEqualsCompileTest extends RegexParsers {
val x: String ~ String = new~("a", "b")
val y: String ~ String = new~("a", "b")
x == y

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admit to having been puzzled by #477, and this test isn't helping me understand it

477 says:

This would allow pattern-based productions to compile in the presence of strict equality

this doesn't sound like a description of what you've done here in the test...?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe @klaeufer is around to add some clarification?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, was teaching last night...thanks for looking into this issue. Looks like my example evolved, and the URL I had included is no longer valid.

Without providing CanEqual[A ~ B, A ~ B], I couldn't get productions such as this to compile:

  def expr: Parser[Expr] =
    term ~! opt(("+" | "-") ~ term) ^^ {
      case l ~ None          => l
      case l ~ Some("+" ~ r) => Plus(l, r)
      case l ~ Some("-" ~ r) => Minus(l, r)
    }

The original source is here.

Let me know if there is anything else I should clarify.

}