Skip to content

Commit a47fa52

Browse files
committed
Move Reflection to scala.quoted
In theory it should be inside of the QuoteContext but this is blocked by scala#10253. We take this first step to cleanup the `scala.tasty` package
1 parent c3ac180 commit a47fa52

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

compiler/src/dotty/tools/dotc/quoted/QuoteContextImpl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
7979
}
8080
end extension
8181

82-
object reflect extends scala.tasty.Reflection:
82+
object reflect extends scala.quoted.Reflection:
8383

8484
def rootContext: Context = ctx
8585

library/src/scala/quoted/QuoteContext.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ trait QuoteContext { self: internal.QuoteUnpickler & internal.QuoteMatching =>
6666
/** Low-level Typed AST API metaprogramming API.
6767
* This API does not have the static type guarantiees that `Expr` and `Type` provide.
6868
*/
69-
val reflect: scala.tasty.Reflection
69+
val reflect: scala.quoted.Reflection
70+
// TODO move Reflcetion definition in here
7071

7172
/** Type of a QuoteContext provided by a splice within a quote that took this context.
7273
* It is only required if working with the reflection API.

library/src/scala/tasty/Reflection.scala renamed to library/src/scala/quoted/Reflection.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
package scala.tasty
1+
package scala.quoted
22

33
import scala.tasty.reflect._
44

5-
/** TASTy Reflect Interface.
5+
/** AST reflection interface.
66
*
77
* Provides all functionality related with AST based metaprogramming.
88
*

tests/neg-macros/i6324.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Test {
2-
def res(x: quoted.Expr[Int])(using tasty.Reflection): quoted.Expr[Int] = x match {
2+
def res(x: quoted.Expr[Int])(using quoted.Reflection): quoted.Expr[Int] = x match {
33
case '{ 1 + $b } => // error: Type must be fully defined. Consider annotating the splice using a type ascription: (${b}: XYZ).
44
b // error: Not found: b
55
}

tests/neg-macros/i6325.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
object Test {
2-
def res(x: quoted.Expr[Int])(using tasty.Reflection): quoted.Expr[Int] = x match {
2+
def res(x: quoted.Expr[Int])(using quoted.Reflection): quoted.Expr[Int] = x match {
33
case '{ 1 + (${Bind(b)}: Int) } => ??? // error: Not found: Bind
44
case _ => ???
55
}

0 commit comments

Comments
 (0)