diff --git a/.github/workflows/pr_and_push_verification.yml b/.github/workflows/pr_and_push_verification.yml index f4436c3fe3..01fa3b4e04 100644 --- a/.github/workflows/pr_and_push_verification.yml +++ b/.github/workflows/pr_and_push_verification.yml @@ -24,6 +24,8 @@ jobs: run: mvn -P scala-212 clean verify --file pom.xml - name: Build for Scala 2.13 with Maven run: mvn -P scala-213 clean verify --file pom.xml + - name: Build for Scala 3 with Maven + run: mvn -P scala-3 clean verify --file pom.xml - name: Grammar scripts run: | ./tools/grammar/src/main/shell/launch.sh RailRoadDiagramPages -outputDir=grammar/generated/railroad cypher.xml diff --git a/pom.xml b/pom.xml index 3329307ee5..1b6b1bad87 100644 --- a/pom.xml +++ b/pom.xml @@ -29,9 +29,9 @@ 4.7.2 1.13 - 0.10.0 + 0.11.0 5.7.0 - 2.3.3 + 3.0.0 2.2 1.7.0 5.7.0 @@ -39,10 +39,10 @@ 3.2.0 3.2.1 2.22.2 - 3.4.4 - 3.2.2 + 4.9.1 + 3.2.11 0.1.8 - 2.2.0 + 2.6.0 2.6 1.8 1.4 @@ -83,13 +83,7 @@ - - org.scala-lang - scala-library - ${scala.version} - - - + org.opencypher tck ${project.version} @@ -384,15 +378,52 @@ scala-212 2.12 + 2.12 2.12.13 + + + + org.scala-lang + scala-library + ${scala.version} + + + scala-213 2.13 + 2.13 2.13.7 + + + + org.scala-lang + scala-library + ${scala.version} + + + + + + scala-3 + + 3 + 2.13 + 3.3.3 + + + + + org.scala-lang + scala3-library_${scala.binary.version} + ${scala.version} + + + diff --git a/tools/tck-api/pom.xml b/tools/tck-api/pom.xml index afdf4ec05e..94ab04d4f7 100644 --- a/tools/tck-api/pom.xml +++ b/tools/tck-api/pom.xml @@ -63,10 +63,6 @@ - - org.scala-lang - scala-library - org.opencypher @@ -119,4 +115,34 @@ + + + scala-212 + + + org.scala-lang + scala-library + + + + + scala-213 + + + org.scala-lang + scala-library + + + + + scala-3 + + + org.scala-lang + scala3-library_${scala.binary.version} + + + + + diff --git a/tools/tck-api/src/main/scala/org/opencypher/tools/tck/api/CypherTCK.scala b/tools/tck-api/src/main/scala/org/opencypher/tools/tck/api/CypherTCK.scala index 40fcc2c9ec..06703fc5f5 100644 --- a/tools/tck-api/src/main/scala/org/opencypher/tools/tck/api/CypherTCK.scala +++ b/tools/tck-api/src/main/scala/org/opencypher/tools/tck/api/CypherTCK.scala @@ -98,7 +98,7 @@ object CypherTCK { val directoryPath: Path = Paths.get(resource) try { val featurePaths = Files.walk(directoryPath).filter { - t: Path => Files.isRegularFile(t) && t.toString.endsWith(featureSuffix) + (t: Path) => Files.isRegularFile(t) && t.toString.endsWith(featureSuffix) } // Note that converting to list is necessary to cut off lazy evaluation // otherwise evaluation of parsePathFeature will happen after the file system is already closed diff --git a/tools/tck-api/src/main/scala/org/opencypher/tools/tck/values/CypherValueParser.scala b/tools/tck-api/src/main/scala/org/opencypher/tools/tck/values/CypherValueParser.scala index a8783b32ea..80dafba813 100644 --- a/tools/tck-api/src/main/scala/org/opencypher/tools/tck/values/CypherValueParser.scala +++ b/tools/tck-api/src/main/scala/org/opencypher/tools/tck/values/CypherValueParser.scala @@ -33,6 +33,15 @@ import org.opencypher.tools.tck.values.Connection.{backward, forward} case class CypherValueParseException(msg: String, expected: String) extends Exception(msg) class CypherValueParser(val orderedLists: Boolean) { + + implicit object whitespace extends Whitespace { + override def apply(ctx: ParsingRun[_]): ParsingRun[Unit] = { + implicit val p: ParsingRun[_] = ctx + implicit val w: Whitespace = this + invisible.rep + } + } + def parse(s: String): CypherValue = { fastparse.parse(s, cypherValueFromEntireInput(_), verboseFailures = true) match { case Success(value, _) => value @@ -174,6 +183,4 @@ class CypherValueParser(val orderedLists: Boolean) { private def newline[X: P]: P[Unit] = "\n" | "\r\n" | "\r" | "\f" private def invisible[X: P]: P[Unit] = " " | "\t" | newline - - implicit val whitespace: P[_] => P[Unit] = { implicit ctx: ParsingRun[_] => invisible.rep } } diff --git a/tools/tck-api/src/main/scala_3/org/opencypher/tools/tck/api/events/Collections.scala b/tools/tck-api/src/main/scala_3/org/opencypher/tools/tck/api/events/Collections.scala new file mode 100644 index 0000000000..26549d3697 --- /dev/null +++ b/tools/tck-api/src/main/scala_3/org/opencypher/tools/tck/api/events/Collections.scala @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2015-2024 "Neo Technology," + * Network Engine for Objects in Lund AB [http://neotechnology.com] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Attribution Notice under the terms of the Apache License 2.0 + * + * This work was created by the collective efforts of the openCypher community. + * Without limiting the terms of Section 6, any Derivative Work that is not + * approved by the public consensus process of the openCypher Implementers Group + * should not be described as “Cypher” (and Cypher® is a registered trademark of + * Neo4j Inc.) or as "openCypher". Extensions by implementers or prototypes or + * proposals for change that have been documented or implemented should only be + * described as "implementation extensions to Cypher" or as "proposed changes to + * Cypher that are not yet approved by the openCypher community". + */ +package org.opencypher.tools.tck.api.events + +import scala.collection.mutable + +/** + * This is a cut-down version of these classes from the 2.12 Scala collections API that just provides + * the functionality we use. + */ +object Collections { + + trait Subscriber[-Evt, -Pub] { + def notify(pub: Pub, event: Evt): Unit + } + + trait Publisher[Evt] { + private val subs: mutable.Buffer[Subscriber[Evt, Publisher[Evt]]] = mutable.Buffer() + + def subscribe(sub: Subscriber[Evt, Publisher[Evt]]): Unit = { + subs += sub + } + + def removeSubscriptions() = subs.clear() + + def publish(e: Evt) = subs.foreach(_.notify(this, e)) + } + +} diff --git a/tools/tck-api/src/main/scala_3/org/opencypher/tools/tck/values/Hashing.scala b/tools/tck-api/src/main/scala_3/org/opencypher/tools/tck/values/Hashing.scala new file mode 100644 index 0000000000..add945cfc0 --- /dev/null +++ b/tools/tck-api/src/main/scala_3/org/opencypher/tools/tck/values/Hashing.scala @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2015-2024 "Neo Technology," + * Network Engine for Objects in Lund AB [http://neotechnology.com] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Attribution Notice under the terms of the Apache License 2.0 + * + * This work was created by the collective efforts of the openCypher community. + * Without limiting the terms of Section 6, any Derivative Work that is not + * approved by the public consensus process of the openCypher Implementers Group + * should not be described as “Cypher” (and Cypher® is a registered trademark of + * Neo4j Inc.) or as "openCypher". Extensions by implementers or prototypes or + * proposals for change that have been documented or implemented should only be + * described as "implementation extensions to Cypher" or as "proposed changes to + * Cypher that are not yet approved by the openCypher community". + */ +package org.opencypher.tools.tck.values + +import scala.util.hashing.MurmurHash3 + +object Hashing { + + def productHash(p: Product) = MurmurHash3.productHash(p, MurmurHash3.productSeed, ignorePrefix = true) + +} diff --git a/tools/tck-api/src/main/scala_3/org/opencypher/tools/tck/values/OrderingCompatibility.scala b/tools/tck-api/src/main/scala_3/org/opencypher/tools/tck/values/OrderingCompatibility.scala new file mode 100644 index 0000000000..ba7b394b89 --- /dev/null +++ b/tools/tck-api/src/main/scala_3/org/opencypher/tools/tck/values/OrderingCompatibility.scala @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2015-2024 "Neo Technology," + * Network Engine for Objects in Lund AB [http://neotechnology.com] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Attribution Notice under the terms of the Apache License 2.0 + * + * This work was created by the collective efforts of the openCypher community. + * Without limiting the terms of Section 6, any Derivative Work that is not + * approved by the public consensus process of the openCypher Implementers Group + * should not be described as “Cypher” (and Cypher® is a registered trademark of + * Neo4j Inc.) or as "openCypher". Extensions by implementers or prototypes or + * proposals for change that have been documented or implemented should only be + * described as "implementation extensions to Cypher" or as "proposed changes to + * Cypher that are not yet approved by the openCypher community". + */ +package org.opencypher.tools.tck.values + +import scala.math.Ordering.Implicits.seqOrdering + +object OrderingCompatibility { + trait Implicits { + implicit def seqOrdering[CC[X] <: scala.collection.Seq[X], T](implicit ord: Ordering[T]): Ordering[CC[T]] = scala.math.Ordering.Implicits.seqOrdering + } + object Implicits extends Implicits { } +} diff --git a/tools/tck-compatibility-tests/tck-compatibility-tests-util/pom.xml b/tools/tck-compatibility-tests/tck-compatibility-tests-util/pom.xml index 4dbc709b21..eb438a3006 100644 --- a/tools/tck-compatibility-tests/tck-compatibility-tests-util/pom.xml +++ b/tools/tck-compatibility-tests/tck-compatibility-tests-util/pom.xml @@ -73,11 +73,6 @@ - - org.scala-lang - scala-library - - org.opencypher tck-api_${scala.binary.version} @@ -122,5 +117,34 @@ + + + scala-212 + + + org.scala-lang + scala-library + + + + + scala-213 + + + org.scala-lang + scala-library + + + + + scala-3 + + + org.scala-lang + scala3-library_${scala.binary.version} + + + + \ No newline at end of file diff --git a/tools/tck-inspection/pom.xml b/tools/tck-inspection/pom.xml index d1b5382e89..8412ca0980 100644 --- a/tools/tck-inspection/pom.xml +++ b/tools/tck-inspection/pom.xml @@ -147,6 +147,12 @@ 0.7.12 + + scala-3 + + 0.7.12 + + diff --git a/tools/tck-inspection/src/main/scala/org/opencypher/tools/tck/inspection/diff/ElementaryDiff.scala b/tools/tck-inspection/src/main/scala/org/opencypher/tools/tck/inspection/diff/ElementaryDiff.scala index 1a9e5dc120..c7e0e2b48d 100644 --- a/tools/tck-inspection/src/main/scala/org/opencypher/tools/tck/inspection/diff/ElementaryDiff.scala +++ b/tools/tck-inspection/src/main/scala/org/opencypher/tools/tck/inspection/diff/ElementaryDiff.scala @@ -167,7 +167,7 @@ case class LCSbasedListDiff[A](before: List[A], after: List[A]) extends ListDiff case class Memo[I, K, O](f: I => O)(implicit ev: I => K) extends (I => O) { import scala.collection.mutable val cache: mutable.Map[K, O] = mutable.Map.empty[K, O] - override def apply(x: I): O = cache.getOrElseUpdate(x, f(x)) + override def apply(x: I): O = cache.getOrElseUpdate(ev(x), f(x)) } def lcs[A](a: List[(A, Int)], b: List[(A, Int)], eq: (A, A) => Boolean): List[(Int, Int)] = { diff --git a/tools/tck-integrity-tests/pom.xml b/tools/tck-integrity-tests/pom.xml index 2ed0c60ada..90b27dd2ae 100644 --- a/tools/tck-integrity-tests/pom.xml +++ b/tools/tck-integrity-tests/pom.xml @@ -67,11 +67,6 @@ - - org.scala-lang - scala-library - - @@ -114,7 +109,7 @@ io.cucumber - cucumber-scala_${scala.binary.version} + cucumber-scala_${scala2.binary.version} ${dep.cucumber.version} test @@ -157,4 +152,34 @@ + + + + scala-212 + + + org.scala-lang + scala-library + + + + + scala-213 + + + org.scala-lang + scala-library + + + + + scala-3 + + + org.scala-lang + scala3-library_${scala.binary.version} + + + + diff --git a/tools/tck-integrity-tests/src/test/scala/org/opencypher/tools/tck/ValidateScenarioTest.scala b/tools/tck-integrity-tests/src/test/scala/org/opencypher/tools/tck/ValidateScenarioTest.scala index 3ec6c26f40..584825ca70 100644 --- a/tools/tck-integrity-tests/src/test/scala/org/opencypher/tools/tck/ValidateScenarioTest.scala +++ b/tools/tck-integrity-tests/src/test/scala/org/opencypher/tools/tck/ValidateScenarioTest.scala @@ -45,7 +45,7 @@ class ValidateScenarioTest extends AnyFunSpecLike with Matchers { }).head } - private def fixture = + private def fixture: { val validator: ValidateScenario } = new { val validator: ValidateScenario = new ValidateScenario() {} } diff --git a/tools/tck-reporting/pom.xml b/tools/tck-reporting/pom.xml index 7a548826ea..c94e965dba 100644 --- a/tools/tck-reporting/pom.xml +++ b/tools/tck-reporting/pom.xml @@ -44,12 +44,6 @@ ${project.version} - - org.scala-lang - scala-library - ${scala.version} - - io.cucumber cucumber-core @@ -75,4 +69,34 @@ + + + scala-212 + + + org.scala-lang + scala-library + + + + + scala-213 + + + org.scala-lang + scala-library + + + + + scala-3 + + + org.scala-lang + scala3-library_${scala.binary.version} + + + + +