Skip to content

Make inline non final #6316

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
Apr 25, 2019
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 compiler/src/dotty/tools/dotc/core/Flags.scala
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,8 @@ object Flags {
/** Assumed to be pure */
final val StableOrErased: FlagSet = StableRealizable | Erased

/** Labeled `private`, `final`, or `inline` */
final val EffectivelyFinal: FlagSet = Private | Final | Inline
/** Labeled `private`, or `final` */
final val EffectivelyFinal: FlagSet = Private | Final

/** A private method */
final val PrivateMethod: FlagConjunction = allOf(Private, Method)
Expand Down
4 changes: 2 additions & 2 deletions tests/neg-macros/quote-MacroOverride.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ object Test {
}

object B extends A {
inline def f() = ${'{}} // error: may not override
override def g() = () // error: may not override
override inline def f() = () // error: method f of type (): Unit is an inline method, must override at least one concrete method
override def g() = ()
}

}
27 changes: 27 additions & 0 deletions tests/run/quote-MacroOverride.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
object Test {

abstract class A {
inline def f1(): String = "A.f1"
inline def f2(): String = "A.f2"
def f3(): String = "A.f3"
}

object B extends A {
override def f1(): String = "B.f1"
override inline def f2(): String = "B.f2"
override inline def f3(): String = "B.f3"
}

def main(args: Array[String]): Unit = {
val a: A = B
assert(a.f1() == "A.f1")
assert(a.f2() == "A.f2")
assert(a.f3() == "A.f3")

val b: B.type = B
assert(b.f1() == "B.f1")
assert(b.f2() == "B.f2")
assert(b.f3() == "B.f3")
}

}