File tree Expand file tree Collapse file tree 3 files changed +5
-19
lines changed
compiler/src/dotty/tools/dotc/tastyreflect Expand file tree Collapse file tree 3 files changed +5
-19
lines changed Original file line number Diff line number Diff line change @@ -1901,16 +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
- /** Convert `Type` to an `quoted.Type[?]` */
1910
- def QuotedType_seal (self : Type )(using ctx : Context ): scala.quoted.Type [? ] = {
1911
- val dummySpan = ctx.owner.span // FIXME
1912
- new scala.internal.quoted.Type (tpd.TypeTree (self).withSpan(dummySpan), compilerId)
1913
- }
1914
1904
1915
1905
// ///////////////
1916
1906
// DEFINITIONS //
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)
@@ -1617,7 +1619,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
1617
1619
1618
1620
/** Convert `Type` to an `quoted.Type[_]` */
1619
1621
def seal (using ctx : Context ): scala.quoted.Type [_] =
1620
- internal.QuotedType_seal ( self)
1622
+ new scala. internal.quoted. Type ( Inferred ( self), internal.compilerId )
1621
1623
1622
1624
/** Is `self` type the same as `that` type?
1623
1625
* This is the case iff `self <:< that` and `that <:< self`.
Original file line number Diff line number Diff line change @@ -1446,12 +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
- /** Convert `Type` to an `quoted.Type[_]` */
1453
- def QuotedType_seal (self : Type )(using ctx : Context ): scala.quoted.Type [_]
1454
-
1455
1449
1456
1450
// ///////////////
1457
1451
// DEFINITIONS //
You can’t perform that action at this time.
0 commit comments