-
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
Changes from all commits
904aaed
d3bafb1
57c4cf3
a3affa7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -14,6 +14,7 @@ import dotty.tools.dotc.quoted.QuoteUtils._ | |||||
import dotty.tools.dotc.core.Decorators._ | ||||||
|
||||||
import scala.quoted.QuoteContext | ||||||
import scala.quoted.internal.{QuoteUnpickler, QuoteMatching} | ||||||
import dotty.tools.dotc.quoted.printers.{Extractors, SourceCode, SyntaxHighlight} | ||||||
|
||||||
import scala.tasty.reflect._ | ||||||
|
@@ -40,7 +41,7 @@ object QuoteContextImpl { | |||||
|
||||||
} | ||||||
|
||||||
class QuoteContextImpl private (ctx: Context) extends QuoteContext, scala.internal.quoted.QuoteContextInternal: | ||||||
class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickler, QuoteMatching: | ||||||
|
||||||
object reflect extends scala.tasty.Reflection: | ||||||
|
||||||
|
@@ -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) | ||||||
else self match | ||||||
case TermTypeTest(self) => throw new Exception("Expected an expression. This is a partially applied Term. Try eta-expanding the term first.") | ||||||
case _ => throw new Exception("Expected a Term but was: " + self) | ||||||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
else None | ||||||
|
||||||
def tpe: TypeRepr = self.tpe | ||||||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
end TypeTree | ||||||
|
||||||
object TypeTreeMethodsImpl extends TypeTreeMethods: | ||||||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
def typeConstructorOf(clazz: Class[?]): TypeRepr = | ||||||
if (clazz.isPrimitive) | ||||||
if (clazz == classOf[Boolean]) dotc.core.Symbols.defn.BooleanType | ||||||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
def =:=(that: TypeRepr): Boolean = self =:= that | ||||||
def <:<(that: TypeRepr): Boolean = self <:< that | ||||||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
object ExprMatch extends ExprMatchModule: | ||||||
def unapply[TypeBindings <: Tuple, Tup <: Tuple](scrutinee: scala.quoted.Expr[Any])(using pattern: scala.quoted.Expr[Any]): Option[Tup] = | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package scala.quoted.internal | ||
package dotty.tools.dotc.quoted | ||
|
||
class ScopeException(msg: String) extends Exception(msg) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
private def interpretLiteral(value: Any)(implicit env: Env): Object = | ||||||
value.asInstanceOf[Object] | ||||||
|
This file was deleted.
This file was deleted.
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.