Skip to content

Commit cfb8459

Browse files
committed
Revert "Fix Scala 2 Macro check"
This reverts commit a1639a6.
1 parent a1639a6 commit cfb8459

File tree

6 files changed

+6
-12
lines changed

6 files changed

+6
-12
lines changed

compiler/src/dotty/tools/dotc/core/Flags.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,9 @@ object Flags {
661661
/** Is a default parameter in Scala 2*/
662662
final val DefaultParameter: FlagConjunction = allOf(Param, DefaultParameterized)
663663

664+
/** A Scala 2 Macro */
665+
final val Scala2Macro: FlagConjunction = allOf(Macro, Scala2x)
666+
664667
/** A trait that does not need to be initialized */
665668
final val NoInitsTrait: FlagConjunction = allOf(Trait, NoInits)
666669

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -807,9 +807,6 @@ object SymDenotations {
807807
// we need an inline flag on them only do that
808808
// reduceProjection gets access to their rhs
809809

810-
/** Is this a Scala 2 macro */
811-
final def isScala2Macro(implicit ctx: Context): Boolean = is(Macro) && symbol.owner.is(Scala2x)
812-
813810
/** An erased value or an inline method, excluding @forceInline annotated methods.
814811
* The latter have to be kept around to get to parity with Scala.
815812
* This is necessary at least until we have full bootstrap. Right now

compiler/src/dotty/tools/dotc/typer/RefChecks.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,10 @@ object RefChecks {
400400
overrideError("is an extension method, cannot override a normal method")
401401
} else if (other.is(Extension) && !member.is(Extension)) { // (1.9.2)
402402
overrideError("is a normal method, cannot override an extension method")
403-
} else if ((member.isInlineMethod || member.isScala2Macro) && other.is(Deferred) &&
403+
} else if ((member.isInlineMethod || member.is(Scala2Macro)) && other.is(Deferred) &&
404404
member.extendedOverriddenSymbols.forall(_.is(Deferred))) { // (1.10)
405405
overrideError("is an inline method, must override at least one concrete method")
406-
} else if (other.isScala2Macro && !member.isScala2Macro) { // (1.11)
406+
} else if (other.is(Scala2Macro) && !member.is(Scala2Macro)) { // (1.11)
407407
overrideError("cannot be used here - only Scala-2 macros can override Scala-2 macros")
408408
} else if (!compatibleTypes(memberTp(self), otherTp(self)) &&
409409
!compatibleTypes(memberTp(upwardsSelf), otherTp(upwardsSelf))) {

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2655,7 +2655,7 @@ class Typer extends Namer
26552655
tree.tpe <:< wildApprox(pt)
26562656
readaptSimplified(Inliner.inlineCall(tree, pt))
26572657
}
2658-
else if (tree.symbol.isScala2Macro) {
2658+
else if (tree.symbol.is(Macro, butNot = Inline)) {
26592659
if (ctx.settings.XignoreScala2Macros.value) {
26602660
ctx.warning("Scala 2 macro cannot be used in Dotty. See http://dotty.epfl.ch/docs/reference/dropped-features/macros.html", tree.sourcePos)
26612661
tree

tests/neg/override-scala2-macro.check

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/neg/override-scala2-macro.scala

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)