Skip to content

Update to given in scala.quoted #8471

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 9, 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
4 changes: 2 additions & 2 deletions library/src/scala/internal/quoted/Matcher.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private[quoted] object Matcher {
class SymBinding(val sym: Symbol, val fromAbove: Boolean)

def termMatch(scrutineeTerm: Term, patternTerm: Term, hasTypeSplices: Boolean): Option[Tuple] = {
implicit val env: Env = Map.empty
given Env = Map.empty
if (hasTypeSplices) {
val ctx: Context = internal.Context_GADT_setFreshGADTBounds(rootContext)
given Context = ctx
Expand All @@ -51,7 +51,7 @@ private[quoted] object Matcher {

// TODO factor out common logic with `termMatch`
def typeTreeMatch(scrutineeTypeTree: TypeTree, patternTypeTree: TypeTree, hasTypeSplices: Boolean): Option[Tuple] = {
implicit val env: Env = Map.empty
given Env = Map.empty
if (hasTypeSplices) {
val ctx: Context = internal.Context_GADT_setFreshGADTBounds(rootContext)
given Context = ctx
Expand Down
4 changes: 2 additions & 2 deletions library/src/scala/quoted/Expr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import scala.quoted.show.SyntaxHighlight
class Expr[+T] private[scala] {

/** Show a source code like representation of this expression without syntax highlight */
def show(implicit qctx: QuoteContext): String = qctx.show(this, SyntaxHighlight.plain)
def show(using qctx: QuoteContext): String = qctx.show(this, SyntaxHighlight.plain)

/** Show a source code like representation of this expression */
def show(syntaxHighlight: SyntaxHighlight)(implicit qctx: QuoteContext): String = qctx.show(this, syntaxHighlight)
def show(syntaxHighlight: SyntaxHighlight)(using qctx: QuoteContext): String = qctx.show(this, syntaxHighlight)

/** Return the value of this expression.
*
Expand Down
4 changes: 2 additions & 2 deletions library/src/scala/quoted/util/ExprMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ trait ExprMap {
def localCtx(definition: Definition): Context = definition.symbol.localContext
tree match {
case tree: ValDef =>
implicit val ctx = localCtx(tree)
given Context = localCtx(tree)
val rhs1 = tree.rhs.map(x => transformTerm(x, tree.tpt.tpe))
ValDef.copy(tree)(tree.name, tree.tpt, rhs1)
case tree: DefDef =>
implicit val ctx = localCtx(tree)
given Context = localCtx(tree)
DefDef.copy(tree)(tree.name, tree.typeParams, tree.paramss, tree.returnTpt, tree.rhs.map(x => transformTerm(x, tree.returnTpt.tpe)))
case tree: TypeDef =>
tree
Expand Down