File tree Expand file tree Collapse file tree 3 files changed +6
-19
lines changed
compiler/src/dotty/tools/dotc/tastyreflect Expand file tree Collapse file tree 3 files changed +6
-19
lines changed Original file line number Diff line number Diff line change @@ -1887,11 +1887,6 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1887
1887
// QUOTED SEAL/UNSEAL //
1888
1888
// //////////////////////
1889
1889
1890
- def QuotedExpr_seal (self : Term )(using ctx : Context ): Option [scala.quoted.Expr [Any ]] = self.tpe.widen match {
1891
- case _ : Types .MethodType | _ : Types .PolyType => None
1892
- case _ => Some (new scala.internal.quoted.Expr (self, compilerId))
1893
- }
1894
-
1895
1890
/** Convert `Type` to an `quoted.Type[?]` */
1896
1891
def QuotedType_seal (self : Type )(using ctx : Context ): scala.quoted.Type [? ] = {
1897
1892
val dummySpan = ctx.owner.span // FIXME
Original file line number Diff line number Diff line change @@ -621,13 +621,16 @@ 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))
633
+ }
631
634
632
635
/** Type of this term */
633
636
def tpe (using ctx : Context ): Type = internal.Term_tpe (self)
@@ -1616,7 +1619,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
1616
1619
1617
1620
/** Convert `Type` to an `quoted.Type[_]` */
1618
1621
def seal (using ctx : Context ): scala.quoted.Type [_] =
1619
- internal.QuotedType_seal ( self)
1622
+ new scala. internal.quoted. Type ( Inferred ( self), internal.compilerId )
1620
1623
1621
1624
/** Is `self` type the same as `that` type?
1622
1625
* This is the case iff `self <:< that` and `that <:< self`.
Original file line number Diff line number Diff line change @@ -1432,17 +1432,6 @@ trait CompilerInterface {
1432
1432
def Flags_Package : Flags
1433
1433
1434
1434
1435
- // //////////////////////
1436
- // QUOTED SEAL/UNSEAL //
1437
- // //////////////////////
1438
-
1439
- /** Convert `Term` to an `quoted.Expr[Any]` if the term is a valid expression */
1440
- def QuotedExpr_seal (self : Term )(using ctx : Context ): Option [scala.quoted.Expr [Any ]]
1441
-
1442
- /** Convert `Type` to an `quoted.Type[_]` */
1443
- def QuotedType_seal (self : Type )(using ctx : Context ): scala.quoted.Type [_]
1444
-
1445
-
1446
1435
// ///////////////
1447
1436
// DEFINITIONS //
1448
1437
// ///////////////
You can’t perform that action at this time.
0 commit comments