Provide migration of Any functions via super in abstract case
Related to KT-38078
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
// !LANGUAGE: -ForbidSuperDelegationToAbstractFakeOverride -ForbidSuperDelegationToAbstractAnyMethod
|
||||
interface Foo {
|
||||
fun check(): String = "OK"
|
||||
}
|
||||
abstract class Base {
|
||||
abstract fun check(): String
|
||||
}
|
||||
abstract class Derived : Base(), Foo
|
||||
|
||||
class Derived2 : Derived() {
|
||||
override fun check(): String {
|
||||
super<Derived>.<!ABSTRACT_SUPER_CALL_WARNING!>check<!>()
|
||||
return super.<!ABSTRACT_SUPER_CALL_WARNING!>check<!>()
|
||||
}
|
||||
}
|
||||
|
||||
abstract class A {
|
||||
abstract override fun hashCode(): Int
|
||||
}
|
||||
|
||||
interface I
|
||||
|
||||
class B : A(), I { // I is necessary here
|
||||
override fun hashCode() = super.<!ABSTRACT_SUPER_CALL!>hashCode<!>()
|
||||
}
|
||||
+2
-3
@@ -1,5 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: -ForbidSuperDelegationToAbstractFakeOverride
|
||||
// !LANGUAGE: -ForbidSuperDelegationToAbstractFakeOverride -ForbidSuperDelegationToAbstractAnyMethod
|
||||
interface Foo {
|
||||
fun check(): String = "OK"
|
||||
}
|
||||
@@ -22,5 +21,5 @@ abstract class A {
|
||||
interface I
|
||||
|
||||
class B : A(), I { // I is necessary here
|
||||
override fun hashCode() = super.<!ABSTRACT_SUPER_CALL!>hashCode<!>()
|
||||
override fun hashCode() = super.<!ABSTRACT_SUPER_CALL_WARNING!>hashCode<!>()
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +ForbidSuperDelegationToAbstractFakeOverride
|
||||
// !LANGUAGE: +ForbidSuperDelegationToAbstractFakeOverride +ForbidSuperDelegationToAbstractAnyMethod
|
||||
interface Foo {
|
||||
fun check(): String = "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user