Skip to content

Commit af47a1c

Browse files
Merge pull request #10680 from dotty-staging/help-quoted-M2-M3-migration
Help scala.quoted migration from 3.0.0-M2 to 3.0.0-M3
2 parents 7b26811 + a4b39de commit af47a1c

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
@@ -31,6 +31,12 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
3131
*/
3232
def matches(that: Expr[Any]): Boolean
3333

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

0 commit comments

Comments
 (0)