Skip to content

Commit beccb5e

Browse files
committed
Deprecate unlift
1 parent b6653d1 commit beccb5e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

shared/src/main/scala/com/thoughtworks/Extractor.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ sealed trait Extractor[-A, +B] extends (A => Option[B]) {
6868
}
6969
7070
// Convert an optional function to a PartialFunction
71-
val pf2: PartialFunction[Int, String] = f.unlift
71+
val pf2: PartialFunction[Int, String] = Function.unlift(f)
7272
7373
util.Random.nextInt(4) match {
7474
case pf.extract(m) => // Convert a PartialFunction to a pattern
@@ -99,6 +99,7 @@ object Extractor extends LowPriorityExtractor {
9999
}
100100
}
101101

102+
@deprecated("Use Function.unlift instead", "1.1.0")
102103
implicit final class OptionFunctionToPartialFunction[-A, +B] private[Extractor] (underlying: A => Option[B]) {
103104
def unlift: PartialFunction[A, B] = {
104105
case underlying.extract(b) => b

shared/src/test/scala/com/thoughtworks/ExtractorSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class ExtractorSpec extends FreeSpec with Matchers {
5454
None
5555
}
5656
}
57-
val pf2: PartialFunction[Int, String] = f.unlift
57+
val pf2: PartialFunction[Int, String] = Function.unlift(f)
5858

5959
def test(i: Int) = {
6060
i match {

0 commit comments

Comments
 (0)