File tree 6 files changed +12
-6
lines changed
compiler/src/dotty/tools/dotc 6 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -661,9 +661,6 @@ object Flags {
661
661
/** Is a default parameter in Scala 2*/
662
662
final val DefaultParameter : FlagConjunction = allOf(Param , DefaultParameterized )
663
663
664
- /** A Scala 2 Macro */
665
- final val Scala2Macro : FlagConjunction = allOf(Macro , Scala2x )
666
-
667
664
/** A trait that does not need to be initialized */
668
665
final val NoInitsTrait : FlagConjunction = allOf(Trait , NoInits )
669
666
Original file line number Diff line number Diff line change @@ -807,6 +807,9 @@ object SymDenotations {
807
807
// we need an inline flag on them only do that
808
808
// reduceProjection gets access to their rhs
809
809
810
+ /** Is this a Scala 2 macro */
811
+ final def isScala2Macro (implicit ctx : Context ): Boolean = is(Macro ) && symbol.owner.is(Scala2x )
812
+
810
813
/** An erased value or an inline method, excluding @forceInline annotated methods.
811
814
* The latter have to be kept around to get to parity with Scala.
812
815
* This is necessary at least until we have full bootstrap. Right now
Original file line number Diff line number Diff line change @@ -400,10 +400,10 @@ object RefChecks {
400
400
overrideError(" is an extension method, cannot override a normal method" )
401
401
} else if (other.is(Extension ) && ! member.is(Extension )) { // (1.9.2)
402
402
overrideError(" is a normal method, cannot override an extension method" )
403
- } else if ((member.isInlineMethod || member.is( Scala2Macro ) ) && other.is(Deferred ) &&
403
+ } else if ((member.isInlineMethod || member.isScala2Macro ) && other.is(Deferred ) &&
404
404
member.extendedOverriddenSymbols.forall(_.is(Deferred ))) { // (1.10)
405
405
overrideError(" is an inline method, must override at least one concrete method" )
406
- } else if (other.is( Scala2Macro ) && ! member.is( Scala2Macro ) ) { // (1.11)
406
+ } else if (other.isScala2Macro && ! member.isScala2Macro ) { // (1.11)
407
407
overrideError(" cannot be used here - only Scala-2 macros can override Scala-2 macros" )
408
408
} else if (! compatibleTypes(memberTp(self), otherTp(self)) &&
409
409
! compatibleTypes(memberTp(upwardsSelf), otherTp(upwardsSelf))) {
Original file line number Diff line number Diff line change @@ -2753,7 +2753,7 @@ class Typer extends Namer
2753
2753
tree.tpe <:< wildApprox(pt)
2754
2754
readaptSimplified(Inliner .inlineCall(tree, pt))
2755
2755
}
2756
- else if (tree.symbol.is( Macro , butNot = Inline ) ) {
2756
+ else if (tree.symbol.isScala2Macro ) {
2757
2757
if (ctx.settings.XignoreScala2Macros .value) {
2758
2758
ctx.warning(" Scala 2 macro cannot be used in Dotty. See http://dotty.epfl.ch/docs/reference/dropped-features/macros.html" , tree.sourcePos)
2759
2759
tree
Original file line number Diff line number Diff line change
1
+ <56..56> in override-scala2-macro.scala
2
+ error overriding method f in class StringContext of type [A >: Any](args: Seq[A]): String;
3
+ method f of type [A >: Any](args: Seq[A]): String cannot be used here - only Scala-2 macros can override Scala-2 macros
Original file line number Diff line number Diff line change
1
+ class Foo extends StringContext {
2
+ override inline def f [A >: Any ](args : A * ): String = ??? // error
3
+ }
You can’t perform that action at this time.
0 commit comments