Skip to content

Commit 4dbfaa8

Browse files
committed
Remove Macro flag for splice macros
The Macro flag is now only for Scala 2 macros
1 parent be05e0f commit 4dbfaa8

File tree

7 files changed

+6
-21
lines changed

7 files changed

+6
-21
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ object Flags {
407407
/** A Scala 2.12 or higher trait */
408408
final val Scala_2_12_Trait = typeFlag(58, "<scala_2_12_trait>")
409409

410-
/** A macro */
410+
/** A Scala 2 macro */
411411
final val Macro = commonFlag(59, "<macro>")
412412

413413
/** A method that is known to have inherited default parameters */
@@ -608,9 +608,6 @@ object Flags {
608608
/** Is a default parameter in Scala 2*/
609609
final val DefaultParameter = allOf(Param, DefaultParameterized)
610610

611-
/** A Scala 2 Macro */
612-
final val Scala2Macro = allOf(Macro, Scala2x)
613-
614611
/** A trait that does not need to be initialized */
615612
final val NoInitsTrait = allOf(Trait, NoInits)
616613

compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
583583
val abs = sym.is(Abstract) || sym.is(Deferred) || absOver
584584
val over = sym.is(Override) || absOver
585585
new api.Modifiers(abs, over, sym.is(Final), sym.is(Sealed),
586-
sym.is(Implicit), sym.is(Lazy), sym.is(Macro), sym.isSuperAccessor)
586+
sym.is(Implicit), sym.is(Lazy), false, sym.isSuperAccessor)
587587
}
588588

589589
def apiAnnotations(s: Symbol): List[api.Annotation] = {

compiler/src/dotty/tools/dotc/tastyreflect/FlagSet.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class FlagSet(flags: Flags.FlagSet) extends scala.tasty.FlagSet {
1515
def isLazy: Boolean = flags.is(Lazy)
1616
def isOverride: Boolean = flags.is(Override)
1717
def isTransparent: Boolean = flags.is(Transparent)
18-
def isMacro: Boolean = flags.is(Macro)
1918
def isStatic: Boolean = flags.is(JavaStatic)
2019
def isObject: Boolean = flags.is(Module)
2120
def isTrait: Boolean = flags.is(Trait)
@@ -46,7 +45,6 @@ class FlagSet(flags: Flags.FlagSet) extends scala.tasty.FlagSet {
4645
if (isLazy) flags += "lazy"
4746
if (isOverride) flags += "override"
4847
if (isTransparent) flags += "transparent"
49-
if (isMacro) flags += "macro"
5048
if (isStatic) flags += "javaStatic"
5149
if (isObject) flags += "object"
5250
if (isTrait) flags += "trait"

compiler/src/dotty/tools/dotc/transform/PostTyper.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
165165

166166
def markAsMacro(c: Context): Unit =
167167
if (c.owner eq c.outer.owner) markAsMacro(c.outer)
168-
else if (c.owner.isTransparentMethod) {
169-
c.owner.setFlag(Macro)
170-
c.owner.resetFlag(Erased) // FIXME: Macros should be Erased, but that causes problems right now
171-
}
168+
else if (c.owner.isTransparentMethod) () // OK
172169
else if (!c.outer.owner.is(Package)) markAsMacro(c.outer)
173170

174171
if (sym.isSplice || sym.isQuote) {

compiler/src/dotty/tools/dotc/transform/ValueClasses.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ object ValueClasses {
2828
d.isRealMethod &&
2929
isDerivedValueClass(d.owner) &&
3030
!d.isConstructor &&
31-
!d.isSuperAccessor &&
32-
!d.is(Macro)
31+
!d.isSuperAccessor
3332
}
3433

3534
/** The member of a derived value class that unboxes it. */

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,8 @@ object RefChecks {
143143
* 1.8.1 M's type is a subtype of O's type, or
144144
* 1.8.2 M is of type []S, O is of type ()T and S <: T, or
145145
* 1.8.3 M is of type ()S, O is of type []T and S <: T, or
146-
* 1.9 M must not be a typelevel def or a Dotty macro def
146+
* 1.9 M must not be a typelevel def
147147
* 1.10. If M is a 2.x macro def, O cannot be deferred unless there's a concrete method overriding O.
148-
* 1.11. If M is not a macro def, O cannot be a macro def.
149148
* 2. Check that only abstract classes have deferred members
150149
* 3. Check that concrete classes do not have deferred definitions
151150
* that are not implemented in a subclass.
@@ -378,12 +377,8 @@ object RefChecks {
378377
overrideError("must be declared lazy to override a lazy value")
379378
} else if (member.is(Erased) && member.allOverriddenSymbols.forall(_.is(Deferred))) { // (1.9)
380379
overrideError("is an erased method, may not override only deferred methods")
381-
} else if (member.is(Macro, butNot = Scala2x)) { // (1.9)
382-
overrideError("is a macro, may not override anything")
383-
} else if (other.is(Deferred) && member.is(Scala2Macro) && member.extendedOverriddenSymbols.forall(_.is(Deferred))) { // (1.10)
380+
} else if (other.is(Deferred) && member.is(Macro) && member.extendedOverriddenSymbols.forall(_.is(Deferred))) { // (1.10)
384381
overrideError("cannot be used here - term macros cannot override abstract methods")
385-
} else if (other.is(Macro) && !member.is(Macro)) { // (1.11)
386-
overrideError("cannot be used here - only term macros can override term macros")
387382
} else if (!compatibleTypes(memberTp(self), otherTp(self)) &&
388383
!compatibleTypes(memberTp(upwardsSelf), otherTp(upwardsSelf))) {
389384
overrideError("has incompatible type" + err.whyNoMatchStr(memberTp(self), otherTp(self)))

library/src/scala/tasty/FlagSet.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ trait FlagSet {
1111
def isLazy: Boolean
1212
def isOverride: Boolean
1313
def isTransparent: Boolean
14-
def isMacro: Boolean // transparent method containing toplevel splices
1514
def isStatic: Boolean // mapped to static Java member
1615
def isObject: Boolean // an object or its class (used for a ValDef or a ClassDef extends Modifier respectively)
1716
def isTrait: Boolean // a trait (used for a ClassDef)

0 commit comments

Comments
 (0)