Skip to content

Update Unliftable API #9672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion community-build/community-projects/utest
18 changes: 9 additions & 9 deletions compiler/src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -791,15 +791,15 @@ class Definitions {
@tu lazy val QuoteContextClass: ClassSymbol = requiredClass("scala.quoted.QuoteContext")

@tu lazy val LiftableModule: Symbol = requiredModule("scala.quoted.Liftable")
@tu lazy val LiftableModule_BooleanIsLiftable: Symbol = LiftableModule.requiredMethod("BooleanIsLiftable")
@tu lazy val LiftableModule_ByteIsLiftable: Symbol = LiftableModule.requiredMethod("ByteIsLiftable")
@tu lazy val LiftableModule_ShortIsLiftable: Symbol = LiftableModule.requiredMethod("ShortIsLiftable")
@tu lazy val LiftableModule_IntIsLiftable: Symbol = LiftableModule.requiredMethod("IntIsLiftable")
@tu lazy val LiftableModule_LongIsLiftable: Symbol = LiftableModule.requiredMethod("LongIsLiftable")
@tu lazy val LiftableModule_FloatIsLiftable: Symbol = LiftableModule.requiredMethod("FloatIsLiftable")
@tu lazy val LiftableModule_DoubleIsLiftable: Symbol = LiftableModule.requiredMethod("DoubleIsLiftable")
@tu lazy val LiftableModule_CharIsLiftable: Symbol = LiftableModule.requiredMethod("CharIsLiftable")
@tu lazy val LiftableModule_StringIsLiftable: Symbol = LiftableModule.requiredMethod("StringIsLiftable")
@tu lazy val LiftableModule_BooleanLiftable: Symbol = LiftableModule.requiredMethod("BooleanLiftable")
@tu lazy val LiftableModule_ByteLiftable: Symbol = LiftableModule.requiredMethod("ByteLiftable")
@tu lazy val LiftableModule_ShortLiftable: Symbol = LiftableModule.requiredMethod("ShortLiftable")
@tu lazy val LiftableModule_IntLiftable: Symbol = LiftableModule.requiredMethod("IntLiftable")
@tu lazy val LiftableModule_LongLiftable: Symbol = LiftableModule.requiredMethod("LongLiftable")
@tu lazy val LiftableModule_FloatLiftable: Symbol = LiftableModule.requiredMethod("FloatLiftable")
@tu lazy val LiftableModule_DoubleLiftable: Symbol = LiftableModule.requiredMethod("DoubleLiftable")
@tu lazy val LiftableModule_CharLiftable: Symbol = LiftableModule.requiredMethod("CharLiftable")
@tu lazy val LiftableModule_StringLiftable: Symbol = LiftableModule.requiredMethod("StringLiftable")

@tu lazy val InternalQuotedModule: Symbol = requiredModule("scala.internal.quoted.CompileTime")
@tu lazy val InternalQuoted_exprQuote : Symbol = InternalQuotedModule.requiredMethod("exprQuote")
Expand Down
18 changes: 9 additions & 9 deletions compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ class ReifyQuotes extends MacroTransform {
lit.const.tag match {
case Constants.NullTag => ref(defn.InternalQuotedExpr_null)
case Constants.UnitTag => ref(defn.InternalQuotedExpr_unit)
case Constants.BooleanTag => liftedValue(defn.LiftableModule_BooleanIsLiftable)
case Constants.ByteTag => liftedValue(defn.LiftableModule_ByteIsLiftable)
case Constants.ShortTag => liftedValue(defn.LiftableModule_ShortIsLiftable)
case Constants.IntTag => liftedValue(defn.LiftableModule_IntIsLiftable)
case Constants.LongTag => liftedValue(defn.LiftableModule_LongIsLiftable)
case Constants.FloatTag => liftedValue(defn.LiftableModule_FloatIsLiftable)
case Constants.DoubleTag => liftedValue(defn.LiftableModule_DoubleIsLiftable)
case Constants.CharTag => liftedValue(defn.LiftableModule_CharIsLiftable)
case Constants.StringTag => liftedValue(defn.LiftableModule_StringIsLiftable)
case Constants.BooleanTag => liftedValue(defn.LiftableModule_BooleanLiftable)
case Constants.ByteTag => liftedValue(defn.LiftableModule_ByteLiftable)
case Constants.ShortTag => liftedValue(defn.LiftableModule_ShortLiftable)
case Constants.IntTag => liftedValue(defn.LiftableModule_IntLiftable)
case Constants.LongTag => liftedValue(defn.LiftableModule_LongLiftable)
case Constants.FloatTag => liftedValue(defn.LiftableModule_FloatLiftable)
case Constants.DoubleTag => liftedValue(defn.LiftableModule_DoubleLiftable)
case Constants.CharTag => liftedValue(defn.LiftableModule_CharLiftable)
case Constants.StringTag => liftedValue(defn.LiftableModule_StringLiftable)
}
}

Expand Down
4 changes: 2 additions & 2 deletions library/src-bootstrapped/scala/quoted/Expr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ object Expr {
* Otherwise returns the `Some` of the value.
*/
def unlift(using qctx: QuoteContext, unlift: Unliftable[T]): Option[T] =
unlift(expr)
unlift.fromExpr(expr)

/** Return the unlifted value of this expression.
*
Expand All @@ -67,7 +67,7 @@ object Expr {
def reportError =
val msg = s"Expected a known value. \n\nThe value of: ${expr.show}\ncould not be unlifted using $unlift"
report.throwError(msg, expr)
unlift(expr).getOrElse(reportError)
unlift.fromExpr(expr).getOrElse(reportError)
end extension

/** `e.betaReduce` returns an expression that is functionally equivalent to `e`,
Expand Down
Loading