Skip to content

Commit 93dc03d

Browse files
committed
Allow abstract inline overrites
1 parent d9b9f01 commit 93dc03d

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ object RefChecks {
157157
* 1.8.3 M is of type ()S, O is of type []T and S <: T, or
158158
* 1.9.1 If M is erased, O is erased. If O is erased, M is erased or inline.
159159
* 1.9.2 If M or O are extension methods, they must both be extension methods.
160-
* 1.10.1. If O is inline (and deferred, otherwise O would be final), M must be inline
161-
* 1.10.2. If M is inline, M must not be deferred
160+
* 1.10. If O is inline (and deferred, otherwise O would be final), M must be inline
162161
* 1.11. If O is a Scala-2 macro, M must be a Scala-2 macro.
163162
* 2. Check that only abstract classes have deferred members
164163
* 3. Check that concrete classes do not have deferred definitions
@@ -398,10 +397,8 @@ object RefChecks {
398397
overrideError("is an extension method, cannot override a normal method")
399398
else if (other.isAllOf(ExtensionMethod) && !member.isAllOf(ExtensionMethod)) // (1.9.2)
400399
overrideError("is a normal method, cannot override an extension method")
401-
else if other.isInlineMethod && !member.isInlineMethod then // (1.10.1)
400+
else if other.isInlineMethod && !member.isInlineMethod then // (1.10)
402401
overrideError("is not inline, cannot implement an inline method")
403-
else if member.isInlineMethod && member.is(Deferred) then // (1.10.2)
404-
overrideError("is inline method, cannot be an abstract override")
405402
else if (other.isScala2Macro && !member.isScala2Macro) // (1.11)
406403
overrideError("cannot be used here - only Scala-2 macros can override Scala-2 macros")
407404
else if (!compatibleTypes(memberTp(self), otherTp(self)) &&

tests/neg/inline-override.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ object Test {
3030

3131
abstract class E extends A { // error f1
3232
inline override def f1(): Int
33-
inline override def f2(): Int // error
34-
inline override def f3(): Int // error
33+
inline override def f2(): Int
34+
inline override def f3(): Int
3535
inline override def f4(): Int // OK not retained
3636
}
3737

0 commit comments

Comments
 (0)