-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #10222: Move scala.quoted.internal to scala.quoted.internal #10281
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
Fix #10222: Move scala.quoted.internal to scala.quoted.internal #10281
Conversation
6652ddc
to
4a511b4
Compare
4a511b4
to
57c4cf3
Compare
Split `QuoteContextInternal` into `QuoteUnpickler` and `QuoteMatching`. Also make sure that `QuoteContext` must extend `QuoteUnpickler` and `QuoteMatching`
b7a366a
to
a3affa7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -323,10 +323,10 @@ object Splicer { | |||
} | |||
|
|||
private def interpretQuote(tree: Tree)(implicit env: Env): Object = | |||
new scala.quoted.internal.Expr(Inlined(EmptyTree, Nil, QuoteUtils.changeOwnerOfTree(tree, ctx.owner)).withSpan(tree.span), QuoteContextImpl.scopeId) | |||
new dotty.tools.dotc.quoted.ExprImpl(Inlined(EmptyTree, Nil, QuoteUtils.changeOwnerOfTree(tree, ctx.owner)).withSpan(tree.span), QuoteContextImpl.scopeId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new dotty.tools.dotc.quoted.ExprImpl(Inlined(EmptyTree, Nil, QuoteUtils.changeOwnerOfTree(tree, ctx.owner)).withSpan(tree.span), QuoteContextImpl.scopeId) | |
new quoted.ExprImpl(Inlined(EmptyTree, Nil, QuoteUtils.changeOwnerOfTree(tree, ctx.owner)).withSpan(tree.span), QuoteContextImpl.scopeId) |
|
||
private def interpretTypeQuote(tree: Tree)(implicit env: Env): Object = | ||
new scala.quoted.internal.Type(QuoteUtils.changeOwnerOfTree(tree, ctx.owner), QuoteContextImpl.scopeId) | ||
new dotty.tools.dotc.quoted.TypeImpl(QuoteUtils.changeOwnerOfTree(tree, ctx.owner), QuoteContextImpl.scopeId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new dotty.tools.dotc.quoted.TypeImpl(QuoteUtils.changeOwnerOfTree(tree, ctx.owner), QuoteContextImpl.scopeId) | |
new quoted.TypeImpl(QuoteUtils.changeOwnerOfTree(tree, ctx.owner), QuoteContextImpl.scopeId) |
@@ -71,7 +72,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern | |||
case _ => false | |||
def asExpr: scala.quoted.Expr[Any] = | |||
if self.isExpr then | |||
new scala.quoted.internal.Expr(self, QuoteContextImpl.this.hashCode) | |||
new dotty.tools.dotc.quoted.ExprImpl(self, QuoteContextImpl.this.hashCode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new dotty.tools.dotc.quoted.ExprImpl(self, QuoteContextImpl.this.hashCode) | |
new ExprImpl(self, QuoteContextImpl.this.hashCode) |
@@ -315,11 +316,11 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern | |||
object TermMethodsImpl extends TermMethods: | |||
extension (self: Term): | |||
def seal: scala.quoted.Expr[Any] = | |||
if self.isExpr then new scala.quoted.internal.Expr(self, QuoteContextImpl.this.hashCode) | |||
if self.isExpr then new dotty.tools.dotc.quoted.ExprImpl(self, QuoteContextImpl.this.hashCode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self.isExpr then new dotty.tools.dotc.quoted.ExprImpl(self, QuoteContextImpl.this.hashCode) | |
if self.isExpr then new ExprImpl(self, QuoteContextImpl.this.hashCode) |
else throw new Exception("Cannot seal a partially applied Term. Try eta-expanding the term first.") | ||
|
||
def sealOpt: Option[scala.quoted.Expr[Any]] = | ||
if self.isExpr then Some(new scala.quoted.internal.Expr(self, QuoteContextImpl.this.hashCode)) | ||
if self.isExpr then Some(new dotty.tools.dotc.quoted.ExprImpl(self, QuoteContextImpl.this.hashCode)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self.isExpr then Some(new dotty.tools.dotc.quoted.ExprImpl(self, QuoteContextImpl.this.hashCode)) | |
if self.isExpr then Some(new ExprImpl(self, QuoteContextImpl.this.hashCode)) |
@@ -1002,7 +1003,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern | |||
|
|||
object TypeTree extends TypeTreeModule: | |||
def of[T <: AnyKind](using tp: scala.quoted.Type[T]): TypeTree = | |||
tp.asInstanceOf[scala.quoted.internal.Type].typeTree | |||
tp.asInstanceOf[dotty.tools.dotc.quoted.TypeImpl].typeTree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tp.asInstanceOf[dotty.tools.dotc.quoted.TypeImpl].typeTree | |
tp.asInstanceOf[TypeImpl].typeTree |
@@ -1571,7 +1572,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern | |||
|
|||
object TypeRepr extends TypeReprModule: | |||
def of[T <: AnyKind](using tp: scala.quoted.Type[T]): TypeRepr = | |||
tp.asInstanceOf[scala.quoted.internal.Type].typeTree.tpe | |||
tp.asInstanceOf[dotty.tools.dotc.quoted.TypeImpl].typeTree.tpe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tp.asInstanceOf[dotty.tools.dotc.quoted.TypeImpl].typeTree.tpe | |
tp.asInstanceOf[TypeImpl].typeTree.tpe |
@@ -1608,7 +1609,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern | |||
def seal: scala.quoted.Type[_] = self.asType | |||
|
|||
def asType: scala.quoted.Type[?] = | |||
new scala.quoted.internal.Type(Inferred(self), QuoteContextImpl.this.hashCode) | |||
new dotty.tools.dotc.quoted.TypeImpl(Inferred(self), QuoteContextImpl.this.hashCode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new dotty.tools.dotc.quoted.TypeImpl(Inferred(self), QuoteContextImpl.this.hashCode) | |
new TypeImpl(Inferred(self), QuoteContextImpl.this.hashCode) |
@@ -2623,11 +2624,11 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.intern | |||
|
|||
def unpickleExpr[T](pickled: String | List[String], typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Any], scala.quoted.QuoteContext) => scala.quoted.Expr[?]): scala.quoted.Expr[T] = | |||
val tree = PickledQuotes.unpickleTerm(pickled, typeHole, termHole)(using reflect.rootContext) | |||
new scala.quoted.internal.Expr(tree, hash).asInstanceOf[scala.quoted.Expr[T]] | |||
new dotty.tools.dotc.quoted.ExprImpl(tree, hash).asInstanceOf[scala.quoted.Expr[T]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new dotty.tools.dotc.quoted.ExprImpl(tree, hash).asInstanceOf[scala.quoted.Expr[T]] | |
new ExprImpl(tree, hash).asInstanceOf[scala.quoted.Expr[T]] |
|
||
def unpickleType[T <: AnyKind](pickled: String | List[String], typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Any], scala.quoted.QuoteContext) => scala.quoted.Expr[?]): scala.quoted.Type[T] = | ||
val tree = PickledQuotes.unpickleTypeTree(pickled, typeHole, termHole)(using reflect.rootContext) | ||
new scala.quoted.internal.Type(tree, hash).asInstanceOf[scala.quoted.Type[T]] | ||
new dotty.tools.dotc.quoted.TypeImpl(tree, hash).asInstanceOf[scala.quoted.Type[T]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new dotty.tools.dotc.quoted.TypeImpl(tree, hash).asInstanceOf[scala.quoted.Type[T]] | |
new TypeImpl(tree, hash).asInstanceOf[scala.quoted.Type[T]] |
I'll clean up those paths later. I may still change something in the compiler implementation. |
No description provided.