Refactor DelegationChecker and related code

- move getDelegates from CodegenUtil to DelegationResolver, reuse it in
  DelegationChecker
- use getAllOverriddenDescriptors + filterOutOverridden instead of a manual DFS
This commit is contained in:
Alexander Udalov
2016-12-19 12:34:26 +03:00
parent 2dd7d89048
commit 482b43631c
8 changed files with 122 additions and 109 deletions
@@ -0,0 +1,13 @@
interface Base {
fun test() = "Base"
}
class Delegate : Base
abstract class Middle : Base {
override fun test() = "MyClass"
}
abstract class MyClass : Middle()
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>class A : MyClass(), Base by Delegate()<!>
@@ -0,0 +1,40 @@
package
public final class A : MyClass, Base {
public constructor A()
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*2*/ /*delegation*/ fun test(): kotlin.String
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface Base {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open fun test(): kotlin.String
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Delegate : Base {
public constructor Delegate()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun test(): kotlin.String
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public abstract class Middle : Base {
public constructor Middle()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ fun test(): kotlin.String
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public abstract class MyClass : Middle {
public constructor MyClass()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun test(): kotlin.String
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}