File tree Expand file tree Collapse file tree 3 files changed +4
-10
lines changed
compiler/src/dotty/tools/dotc/tastyreflect Expand file tree Collapse file tree 3 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -1901,11 +1901,6 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1901
1901
def QuotedType_unseal (self : scala.quoted.Type [? ])(using ctx : Context ): TypeTree =
1902
1902
PickledQuotes .quotedTypeToTree(self)
1903
1903
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
-
1909
1904
/** Convert `Type` to an `quoted.Type[?]` */
1910
1905
def QuotedType_seal (self : Type )(using ctx : Context ): scala.quoted.Type [? ] = {
1911
1906
val dummySpan = ctx.owner.span // FIXME
Original file line number Diff line number Diff line change @@ -621,13 +621,15 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
621
621
622
622
/** Convert `Term` to an `quoted.Expr[Any]` if the term is a valid expression or throws */
623
623
def seal (using ctx : Context ): scala.quoted.Expr [Any ] =
624
- internal. QuotedExpr_seal (self) .getOrElse {
624
+ sealOpt .getOrElse {
625
625
throw new Exception (" Cannot seal a partially applied Term. Try eta-expanding the term first." )
626
626
}
627
627
628
628
/** Convert `Term` to an `quoted.Expr[Any]` if the term is a valid expression */
629
629
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))
631
633
632
634
/** Type of this term */
633
635
def tpe (using ctx : Context ): Type = internal.Term_tpe (self)
Original file line number Diff line number Diff line change @@ -1446,9 +1446,6 @@ trait CompilerInterface {
1446
1446
/** View this expression `quoted.Type[T]` as a `TypeTree` */
1447
1447
def QuotedType_unseal (self : scala.quoted.Type [_])(using ctx : Context ): TypeTree
1448
1448
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
-
1452
1449
/** Convert `Type` to an `quoted.Type[_]` */
1453
1450
def QuotedType_seal (self : Type )(using ctx : Context ): scala.quoted.Type [_]
1454
1451
You can’t perform that action at this time.
0 commit comments