@@ -143,6 +143,7 @@ object RefChecks {
143143 *
144144 * 1.1. M must have the same or stronger access privileges as O.
145145 * 1.2. O must not be effectively final.
146+ * 1.9.2 If M or O are extension methods, they must both be extension methods.
146147 * 1.3. O is deferred, or M has `override` modifier.
147148 * 1.4. If O is stable, then so is M.
148149 * // @M: LIFTED 1.5. Neither M nor O are a parameterized type alias
@@ -157,7 +158,6 @@ object RefChecks {
157158 * 1.8.2 M is of type []S, O is of type ()T and S <: T, or
158159 * 1.8.3 M is of type ()S, O is of type []T and S <: T, or
159160 * 1.9.1 If M is erased, O is erased. If O is erased, M is erased or inline.
160- * 1.9.2 If M or O are extension methods, they must both be extension methods.
161161 * 1.10. If O is inline (and deferred, otherwise O would be final), M must be inline
162162 * 1.11. If O is a Scala-2 macro, M must be a Scala-2 macro.
163163 * 2. Check that only abstract classes have deferred members
@@ -343,6 +343,10 @@ object RefChecks {
343343 overrideError(" cannot be used here - classes can only override abstract types" )
344344 else if (other.isEffectivelyFinal) // (1.2)
345345 overrideError(i " cannot override final member ${other.showLocated}" )
346+ else if (member.isAllOf(ExtensionMethod ) && ! other.isAllOf(ExtensionMethod )) // (1.9.2)
347+ overrideError(" is an extension method, cannot override a normal method" )
348+ else if (other.isAllOf(ExtensionMethod ) && ! member.isAllOf(ExtensionMethod )) // (1.9.2)
349+ overrideError(" is a normal method, cannot override an extension method" )
346350 else if (! other.is(Deferred ) &&
347351 ! other.name.is(DefaultGetterName ) &&
348352 ! member.isAnyOverride)
@@ -394,10 +398,6 @@ object RefChecks {
394398 overrideError(" is erased, cannot override non-erased member" )
395399 else if (other.is(Erased ) && ! member.isOneOf(Erased | Inline )) // (1.9.1)
396400 overrideError(" is not erased, cannot override erased member" )
397- else if (member.isAllOf(ExtensionMethod ) && ! other.isAllOf(ExtensionMethod )) // (1.9.2)
398- overrideError(" is an extension method, cannot override a normal method" )
399- else if (other.isAllOf(ExtensionMethod ) && ! member.isAllOf(ExtensionMethod )) // (1.9.2)
400- overrideError(" is a normal method, cannot override an extension method" )
401401 else if other.is(Inline ) && ! member.is(Inline ) then // (1.10)
402402 overrideError(" is not inline, cannot implement an inline method" )
403403 else if (other.isScala2Macro && ! member.isScala2Macro) // (1.11)
0 commit comments