Skip to content

Remove unnecessary imports part 2 #8511

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
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
20 changes: 6 additions & 14 deletions library/src/scala/quoted/QuoteContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,12 @@ class QuoteContext(val tasty: scala.tasty.Reflection) { self =>
}

/** Report an error at the position of the macro expansion */
def error(msg: => String): Unit = {
import tasty.{_, given _}
tasty.error(msg, rootPosition)
}
def error(msg: => String): Unit =
tasty.error(msg, tasty.rootPosition)

/** Report an error at the on the position of `expr` */
def error(msg: => String, expr: Expr[Any]): Unit = {
import tasty.{_, given _}
def error(msg: => String, expr: Expr[Any]): Unit =
tasty.error(msg, expr.unseal(using this).pos)
}

/** Report an error at the position of the macro expansion and throws a StopQuotedContext */
def throwError(msg: => String): Nothing = {
Expand All @@ -53,15 +49,11 @@ class QuoteContext(val tasty: scala.tasty.Reflection) { self =>
}

/** Report a warning */
def warning(msg: => String): Unit = {
import tasty.{_, given _}
tasty.warning(msg, rootPosition)
}
def warning(msg: => String): Unit =
tasty.warning(msg, tasty.rootPosition)

/** Report a warning at the on the position of `expr` */
def warning(msg: => String, expr: Expr[_]): Unit = {
import tasty.{_, given _}
def warning(msg: => String, expr: Expr[_]): Unit =
tasty.warning(msg, expr.unseal(using this).pos)
}

}
2 changes: 1 addition & 1 deletion library/src/scala/tasty/reflect/ExtractorsPrinter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package scala.tasty
package reflect

class ExtractorsPrinter[R <: Reflection & Singleton](val tasty: R) extends Printer[R] {
import tasty.{_, given _}
import tasty._

def showTree(tree: Tree)(using ctx: Context): String =
new Buffer().visitTree(tree).result()
Expand Down
2 changes: 1 addition & 1 deletion library/src/scala/tasty/reflect/SourceCodePrinter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import scala.quoted.show.SyntaxHighlight

/** Printer for fully elaborated representation of the source code */
class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlight: SyntaxHighlight) extends Printer[R] {
import tasty.{_, given _}
import tasty._
import syntaxHighlight._

def showTree(tree: Tree)(using ctx: Context): String =
Expand Down