Skip to content

Update tasty imports #8552

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

Merged
merged 1 commit into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/neg-macros/macros-in-same-project-6/Foo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ object Foo {
inline def myMacro(): Unit = ${ aMacroImplementation }

def aMacroImplementation(using qctx: QuoteContext) : Expr[Unit] = {
import qctx.tasty.{given _, _}
import qctx.tasty._
error("some error", rootPosition)
throw new NoClassDefFoundError("Bar$")
}
Expand Down
2 changes: 1 addition & 1 deletion tests/pos-macros/i8325/Macro_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object A:
def pure[A](a:A):A = ???

def transformImplExpr[A:Type](using qctx: QuoteContext)(expr: Expr[A]): Expr[A] = {
import qctx.tasty.{given _, _}
import qctx.tasty._
expr.unseal match {
case Inlined(x,y,z) => transformImplExpr(z.seal.asInstanceOf[Expr[A]])
case Apply(fun,args) => '{ A.pure(${Apply(fun,args).seal.asInstanceOf[Expr[A]]}) }
Expand Down
2 changes: 1 addition & 1 deletion tests/pos-macros/i8325b/Macro_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object A:
def pure[A](a:A):A = ???

def transformImplExpr[A:Type](using qctx: QuoteContext)(expr: Expr[A]): Expr[A] = {
import qctx.tasty.{given _, _}
import qctx.tasty._
expr.unseal match {
case Inlined(x,y,z) => transformImplExpr(z.seal.asInstanceOf[Expr[A]])
case r@Apply(fun,args) => '{
Expand Down
2 changes: 1 addition & 1 deletion tests/pos/i7887.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def typed[A](using t: quoted.Type[A], qctx: quoted.QuoteContext): Unit = {
import qctx.tasty.{given _, _}
import qctx.tasty._
'{
type T = $t
${'{???}.cast[T]}
Expand Down
4 changes: 2 additions & 2 deletions tests/run-macros/i6803/Macro_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object AsObject {
def unsafe(i: Int): LineNo = new LineNo(i)
inline given LineNo = ${impl}
private def impl(using qctx: QuoteContext): Expr[LineNo] = {
import qctx.tasty.{given _, _}
import qctx.tasty._
'{unsafe(${Expr(rootPosition.startLine)})}
}
}
Expand All @@ -21,7 +21,7 @@ package AsPackage {
def unsafe(i: Int): LineNo = new LineNo(i)
inline given LineNo = ${impl}
private def impl(using qctx: QuoteContext): Expr[LineNo] = {
import qctx.tasty.{given _, _}
import qctx.tasty._
'{unsafe(${Expr(rootPosition.startLine)})}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/run-macros/i7025/Macros_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object Macros {
inline def debug: Unit = ${Macros.debugImpl}

def debugImpl(using qctx: QuoteContext): Expr[Unit] = {
import qctx.tasty.{given _, _}
import qctx.tasty._

def nearestEnclosingDef(owner: Symbol): Symbol =
if owner.isClassDef then owner
Expand Down
2 changes: 1 addition & 1 deletion tests/run-macros/quote-matcher-runtime/quoted_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ object Macros {
inline def matches[A, B](inline a: A, inline b: B): Unit = ${impl('a, 'b)}

private def impl[A, B](a: Expr[A], b: Expr[B])(using qctx: QuoteContext) : Expr[Unit] = {
import qctx.tasty.{Bind => _, given _, _}
import qctx.tasty._

val res = scala.internal.quoted.Expr.unapply[Tuple, Tuple](a)(using b, true, qctx).map { tup =>
tup.toArray.toList.map {
Expand Down
2 changes: 1 addition & 1 deletion tests/run-macros/quote-type-matcher/quoted_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ object Macros {
inline def matches[A, B]: Unit = ${ matchesExpr('[A], '[B]) }

private def matchesExpr[A, B](a: Type[A], b: Type[B])(using qctx: QuoteContext) : Expr[Unit] = {
import qctx.tasty.{Bind => _, given _, _}
import qctx.tasty._

val res = scala.internal.quoted.Type.unapply[Tuple, Tuple](a)(using b, true, qctx).map { tup =>
tup.toArray.toList.map {
Expand Down
2 changes: 1 addition & 1 deletion tests/run-macros/quoted-matching-docs/Macro_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ private def sumExprShow(argsExpr: Expr[Seq[Int]]) (using QuoteContext): Expr[Str
Expr(sumExpr(argsExpr).show)

private def sumExpr(argsExpr: Expr[Seq[Int]])(using qctx: QuoteContext) : Expr[Int] = {
import qctx.tasty.{given _, _}
import qctx.tasty._
UnsafeExpr.underlyingArgument(argsExpr) match {
case Varargs(Consts(args)) => // args is of type Seq[Int]
Expr(args.sum) // precompute result of sum
Expand Down
4 changes: 2 additions & 2 deletions tests/run-macros/refined-selectable-macro/Macro_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object Macro {
}

private def toTupleImpl(s: Expr[Selectable])(using qctx:QuoteContext) : Expr[Tuple] = {
import qctx.tasty.{given _, _}
import qctx.tasty._

val repr = s.unseal.tpe.widenTermRefExpr.dealias

Expand Down Expand Up @@ -46,7 +46,7 @@ object Macro {
}

private def fromTupleImpl[T: Type](s: Expr[Tuple], newRecord: Expr[Array[(String, Any)] => T])(using qctx:QuoteContext) : Expr[Any] = {
import qctx.tasty.{given _, _}
import qctx.tasty._

val repr = s.unseal.tpe.widenTermRefExpr.dealias

Expand Down
2 changes: 1 addition & 1 deletion tests/run-macros/requiredSymbols/Macro_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import scala.quoted._
object Macro {
inline def foo: String = ${ fooImpl }
def fooImpl(using qctx: QuoteContext) : Expr[String] = {
import qctx.tasty.{given _, _}
import qctx.tasty._
val list = List(
rootContext.requiredPackage("java"),
rootContext.requiredPackage("java.lang"),
Expand Down
2 changes: 1 addition & 1 deletion tests/run-macros/tasty-construct-types/Macro_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object Macros {
class TestAnnotation extends scala.annotation.Annotation

def theTestBlockImpl(using qctx : QuoteContext) : Expr[Unit] = {
import qctx.tasty.{_,given _}
import qctx.tasty._

val x1T = ConstantType(Constant(1))
val x2T = OrType(ConstantType(Constant(1)), ConstantType(Constant(2)))
Expand Down
2 changes: 1 addition & 1 deletion tests/run-macros/tasty-positioned/quoted_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object Positioned {
implicit inline def apply[T](x: => T): Positioned[T] = ${impl('x)}

def impl[T](x: Expr[T])(implicit ev: Type[T], qctx: QuoteContext): Expr[Positioned[T]] = {
import qctx.tasty.{Position => _, _, given _}
import qctx.tasty.{Position => _, _}
val pos = rootPosition

val path = pos.sourceFile.jpath.toString
Expand Down