@@ -266,8 +266,8 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
266
266
267
267
object DefDef extends DefDefModule :
268
268
def apply (symbol : Symbol , rhsFn : List [List [Tree ]] => Option [Term ]): DefDef =
269
- assert(xCheckMacro && symbol.isTerm, s " expected a term symbol but received $symbol" )
270
- assert(xCheckMacro && symbol.flags.is(Flags .Method ), " expected a symbol with `Method` flag set" )
269
+ assert(! xCheckMacro || symbol.isTerm, s " expected a term symbol but received $symbol" )
270
+ assert(! xCheckMacro || symbol.flags.is(Flags .Method ), " expected a symbol with `Method` flag set" )
271
271
withDefaultPos(tpd.DefDef (symbol.asTerm, prefss =>
272
272
xCheckedMacroOwners(xCheckMacroValidExpr(rhsFn(prefss)), symbol).getOrElse(tpd.EmptyTree )
273
273
))
@@ -298,7 +298,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
298
298
299
299
object ValDef extends ValDefModule :
300
300
def apply (symbol : Symbol , rhs : Option [Term ]): ValDef =
301
- assert(xCheckMacro && ! symbol.flags.is(Flags .Method ), " expected a symbol without `Method` flag set" )
301
+ assert(! xCheckMacro || ! symbol.flags.is(Flags .Method ), " expected a symbol without `Method` flag set" )
302
302
tpd.ValDef (symbol.asTerm, xCheckedMacroOwners(xCheckMacroValidExpr(rhs), symbol).getOrElse(tpd.EmptyTree ))
303
303
def copy (original : Tree )(name : String , tpt : TypeTree , rhs : Option [Term ]): ValDef =
304
304
tpd.cpy.ValDef (original)(name.toTermName, tpt, xCheckedMacroOwners(xCheckMacroValidExpr(rhs), original.symbol).getOrElse(tpd.EmptyTree ))
@@ -1475,7 +1475,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
1475
1475
1476
1476
object Bind extends BindModule :
1477
1477
def apply (sym : Symbol , pattern : Tree ): Bind =
1478
- assert(xCheckMacro && sym.flags.is(Flags .Case ), " expected a symbol with `Case` flag set" )
1478
+ assert(! xCheckMacro || sym.flags.is(Flags .Case ), " expected a symbol with `Case` flag set" )
1479
1479
tpd.Bind (sym, pattern)
1480
1480
def copy (original : Tree )(name : String , pattern : Tree ): Bind =
1481
1481
withDefaultPos(tpd.cpy.Bind (original)(name.toTermName, pattern))
@@ -2504,7 +2504,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
2504
2504
// We introduce this check under this flag to not break published macros that may have accidentally used a wrong flag but happen to work.
2505
2505
// Once macro implementation had a compiler version or two too find their bugs and patch them we can enforce it on every use site.
2506
2506
assert(
2507
- xCheckMacro && flags <= valid,
2507
+ ! xCheckMacro || flags <= valid,
2508
2508
s " Received invalid flags. Expected flags ${flags.show} to only contain a subset of ${valid.show}. "
2509
2509
)
2510
2510
0 commit comments