diff --git a/MIGRATION.md b/MIGRATION.md index b99395701..fffba894a 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -18,6 +18,7 @@ the bottom of this file. Restoration ships incrementally per feature area. | `-Wconf` warning suppression blocks | Project rule: fix warnings at source, not via suppression. | | `-language:experimental.macros` | Scala 3 uses `inline` + `scala.quoted`; flag is a no-op. | | Scala 2 macro impls (`c.universe`, blackbox/whitebox) | Replaced by Scala 3 quotes/inline during feature-area restoration; the legacy `commons-macros` module is gone. | +| `misc/Bidirectional` | Scala 2 whitebox macro deleted from the Scala 3 tree (file + test removed). Restoration not planned: write the reversed `PartialFunction` manually at call sites. A `@deprecated` shim shipping in the parallel Scala 2 `master` PR gives downstream a warning window before the symbol disappears. | ## 2. Deprecated on Scala 3 @@ -158,7 +159,6 @@ Full per-file list with locations is in the Backlog table below (filter rows whe | `core/src/main/scala/com/avsystem/commons/misc/ApplierUnapplier.scala:13` | Applier.materialize (Scala 2 macro def) | L | | `core/src/main/scala/com/avsystem/commons/misc/ApplierUnapplier.scala:25` | Unapplier.materialize (Scala 2 macro def) | L | | `core/src/main/scala/com/avsystem/commons/misc/ApplierUnapplier.scala:37` | ApplierUnapplier.materialize (Scala 2 macro def) | L | -| `core/src/main/scala/com/avsystem/commons/misc/Bidirectional.scala:6` | apply (Scala 2 macro def) | L | | `core/src/main/scala/com/avsystem/commons/misc/Delegation.scala:11` | materializeDelegation (Scala 2 macro def) | L | | `core/src/main/scala/com/avsystem/commons/misc/Delegation.scala:21` | CurriedDelegation.apply (Scala 2 macro def) | L | | `core/src/main/scala/com/avsystem/commons/misc/Implicits.scala:5` | infer (Scala 2 macro def) | L | diff --git a/core/src/main/scala/com/avsystem/commons/misc/Bidirectional.scala b/core/src/main/scala/com/avsystem/commons/misc/Bidirectional.scala deleted file mode 100644 index 1e1542b01..000000000 --- a/core/src/main/scala/com/avsystem/commons/misc/Bidirectional.scala +++ /dev/null @@ -1,8 +0,0 @@ -package com.avsystem.commons -package misc - -/** Creates reversed partial function. */ -object Bidirectional { - // TODO[scala3-port]: apply (Scala 2 macro def) (L) - def apply[A, B](pf: PartialFunction[A, B]): (PartialFunction[A, B], PartialFunction[B, A]) = ??? -} diff --git a/core/src/test/scala/com/avsystem/commons/misc/BidirectionalTest.scala b/core/src/test/scala/com/avsystem/commons/misc/BidirectionalTest.scala deleted file mode 100644 index 2d9c33bab..000000000 --- a/core/src/test/scala/com/avsystem/commons/misc/BidirectionalTest.scala +++ /dev/null @@ -1,109 +0,0 @@ -package com.avsystem.commons -package misc - -import org.scalatest.matchers.should.Matchers -import org.scalatest.wordspec.AnyWordSpec - -class BidirectionalTest extends AnyWordSpec with Matchers { - "Bidirectional" should { - "create reversed partial function" in { - val (pf, rpf) = Bidirectional[Int, String] { - case 1 => "1" - case 2 => "2" - case 3 => "3" - } - - pf(1) should be("1") - pf(2) should be("2") - pf(3) should be("3") - rpf("1") should be(1) - rpf("2") should be(2) - rpf("3") should be(3) - - case class A(i: Int) - case class B(s: String) - - val (ccpf, ccrpf) = Bidirectional[A, B] { - case A(1) => B("1") - case A(2) => B("2") - case A(3) => B("3") - } - - ccpf(A(1)) should be(B("1")) - ccpf(A(2)) should be(B("2")) - ccpf(A(3)) should be(B("3")) - ccrpf(B("1")) should be(A(1)) - ccrpf(B("2")) should be(A(2)) - ccrpf(B("3")) should be(A(3)) - } - - "not compile if bodies are not unique" in { - """val (pf, rpf) = Bidirectional[Int, String]({ - | case 1 => "1" - | case 2 => "2" - | case 3 => "3" - |})""".stripMargin should compile - - """val (pf, rpf) = Bidirectional[Int, String]({ - | case 1 => "1" - | case 2 => "3" - | case 3 => "3" - |})""".stripMargin shouldNot compile - - """case class A(a: Int) - |case class B(b: String) - | - |val (pf, rpf) = Bidirectional[A, B]({ - | case A(1) => B("1") - | case A(2) => B("2") - | case A(3) => B("3") - |})""".stripMargin should compile - - """case class A(a: Int) - |case class B(b: String) - | - |val (pf, rpf) = Bidirectional[A, B]({ - | case A(1) => B("1") - | case A(2) => B("3") - | case A(3) => B("3") - |})""".stripMargin shouldNot compile - - """var x = "OK" - |val (pf, rpf) = Bidirectional[String, String]({ - | case x if x == "ok" => "OK" - | case x => x - |})""".stripMargin should compile - - """var x = "OK" - |val (pf, rpf) = Bidirectional[String, String]({ - | case x if x == "ok" => "OK" - | case x => "OK" - |})""".stripMargin shouldNot compile - } - - "not compile if pf contains expressions" in { - """val t = "a" - |val (pf, rpf) = Bidirectional[String, String]({ - | case "A" => t + "OK" - | case "B" => "FAIL" - |})""".stripMargin shouldNot compile - } - - "not compile if pf uses wildcards in patterns" in { - """var x = "ok" - |val (pf, rpf) = Bidirectional[String, String]({ - | case x if x == "ok" => "OK" - | case x => x - |})""".stripMargin should compile - - """val (pf, rpf) = Bidirectional[String, String]({ - | case x if x == "ok" => "OK" - |})""".stripMargin shouldNot compile - - """val (pf, rpf) = Bidirectional[String, String]({ - | case _ => "OK" - |})""".stripMargin shouldNot compile - } - - } -}