Skip to content

Commit a4b39de

Browse files
committed
Help scala.quoted migration from 3.0.0-M2 to 3.0.0-M3
Add back deprecated `Unlifted`, `unlift` and `unliftOrError`
1 parent 07eda7c commit a4b39de

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package scala.quoted
2+
3+
@deprecated("Use `scala.quoted.Expr` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3")
4+
object Unlifted:
5+
6+
@deprecated("Use `scala.quoted.Expr.unapply` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3")
7+
def apply[T](expr: Expr[T])(using FromExpr[T])(using Quotes): Option[T] =
8+
Expr.unapply(expr)
9+
10+
@deprecated("Use `scala.quoted.Exprs.unapply` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3")
11+
def unapply[T](exprs: Seq[Expr[T]])(using FromExpr[T])(using Quotes): Option[Seq[T]] =
12+
Exprs.unapply(exprs)
13+
14+
end Unlifted

library/src/scala/quoted/Quotes.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
3333
*/
3434
def matches(that: Expr[Any]): Boolean
3535

36+
@deprecated("Use `.value` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3")
37+
def unlift(using FromExpr[T]): Option[T] = self.value
38+
39+
@deprecated("Use `.unliftOrError` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3")
40+
def unliftOrError(using FromExpr[T]): T = self.valueOrError
41+
3642
/** Return the value of this expression.
3743
*
3844
* Returns `None` if the expression does not represent a value or possibly contains side effects.

0 commit comments

Comments
 (0)