Skip to content

Commit b33ca8a

Browse files
committed
Remove Expr seal from CompilerInterface
1 parent da41b1a commit b33ca8a

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

compiler/src/dotty/tools/dotc/tastyreflect/ReflectionCompilerInterface.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,11 +1901,6 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
19011901
def QuotedType_unseal(self: scala.quoted.Type[?])(using ctx: Context): TypeTree =
19021902
PickledQuotes.quotedTypeToTree(self)
19031903

1904-
def QuotedExpr_seal(self: Term)(using ctx: Context): Option[scala.quoted.Expr[Any]] = self.tpe.widen match {
1905-
case _: Types.MethodType | _: Types.PolyType => None
1906-
case _ => Some(new scala.internal.quoted.Expr(self, compilerId))
1907-
}
1908-
19091904
/** Convert `Type` to an `quoted.Type[?]` */
19101905
def QuotedType_seal(self: Type)(using ctx: Context): scala.quoted.Type[?] = {
19111906
val dummySpan = ctx.owner.span // FIXME

library/src/scala/tasty/Reflection.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,13 +621,15 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
621621

622622
/** Convert `Term` to an `quoted.Expr[Any]` if the term is a valid expression or throws */
623623
def seal(using ctx: Context): scala.quoted.Expr[Any] =
624-
internal.QuotedExpr_seal(self).getOrElse {
624+
sealOpt.getOrElse {
625625
throw new Exception("Cannot seal a partially applied Term. Try eta-expanding the term first.")
626626
}
627627

628628
/** Convert `Term` to an `quoted.Expr[Any]` if the term is a valid expression */
629629
def sealOpt(using ctx: Context): Option[scala.quoted.Expr[Any]] =
630-
internal.QuotedExpr_seal(self)
630+
self.tpe.widen match
631+
case _: MethodType | _: PolyType => None
632+
case _ => Some(new scala.internal.quoted.Expr(self, internal.compilerId))
631633

632634
/** Type of this term */
633635
def tpe(using ctx: Context): Type = internal.Term_tpe(self)

library/src/scala/tasty/reflect/CompilerInterface.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,9 +1446,6 @@ trait CompilerInterface {
14461446
/** View this expression `quoted.Type[T]` as a `TypeTree` */
14471447
def QuotedType_unseal(self: scala.quoted.Type[_])(using ctx: Context): TypeTree
14481448

1449-
/** Convert `Term` to an `quoted.Expr[Any]` if the term is a valid expression */
1450-
def QuotedExpr_seal(self: Term)(using ctx: Context): Option[scala.quoted.Expr[Any]]
1451-
14521449
/** Convert `Type` to an `quoted.Type[_]` */
14531450
def QuotedType_seal(self: Type)(using ctx: Context): scala.quoted.Type[_]
14541451

0 commit comments

Comments
 (0)