Use descriptors for building SAM constructors

It helps to get rid of semantics duplicating and fixes known bugs

- SOE in OnlyAbstractMethodFinder.find
- type enhancement for SAM constructors

 #KT-11287 Fixed
 #KT-11322 Fixed
 EA-77989 Fixed
This commit is contained in:
Denis Zharkov
2016-03-07 17:49:03 +03:00
parent b8b48c5f98
commit 151e55b2fa
22 changed files with 234 additions and 258 deletions
@@ -0,0 +1,28 @@
// FILE: A.java
public interface A extends A {
int getFoo();
}
// FILE: B.java
public class B {
interface B1 extends B2 {
int getFoo();
}
interface B2 extends B3 {
int getFoo();
}
interface B3 extends B2 {
int getFoo();
}
}
// FILE: main.kt
fun foo() {
object : A { override fun getFoo() = 1 }
object : B.B1 { override fun getFoo() = 1 }
object : B.B2 { override fun getFoo() = 1 }
object : B.B3 { override fun getFoo() = 1 }
}
@@ -0,0 +1,32 @@
package
public /*synthesized*/ fun A(/*0*/ function: () -> kotlin.Int): A
public fun foo(): kotlin.Unit
public interface A {
public abstract fun getFoo(): kotlin.Int
}
public open class B {
public constructor B()
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 toString(): kotlin.String
public/*package*/ interface B1 : B.B2 {
public abstract override /*1*/ fun getFoo(): kotlin.Int
}
public/*package*/ interface B2 {
public abstract fun getFoo(): kotlin.Int
}
public/*package*/ interface B3 {
public abstract fun getFoo(): kotlin.Int
}
// Static members
public/*package*/ final /*synthesized*/ fun B1(/*0*/ function: () -> kotlin.Int): B.B1
public/*package*/ final /*synthesized*/ fun B2(/*0*/ function: () -> kotlin.Int): B.B2
public/*package*/ final /*synthesized*/ fun B3(/*0*/ function: () -> kotlin.Int): B.B3
}
@@ -0,0 +1,24 @@
// FILE: A.java
public interface A extends A.B {
interface B extends A { public int getFoo() { return 1; } }
}
// FILE: A0.java
public interface A0 extends A0.B {
interface B { public int getFoo() { return 1; } }
}
// FILE: B.java
public class B extends D {
public int getFoo() { return 1; }
public static class C {
public int getFoo() { return 1; }
}
}
// FILE: D.java
public class D extends B.C {
public int getFoo() { return 1; }
}
@@ -0,0 +1,42 @@
package
public interface A {
public interface B {
public abstract fun getFoo(): kotlin.Int
}
// Static members
public final /*synthesized*/ fun B(/*0*/ function: () -> kotlin.Int): A.B
}
public interface A0 {
public interface B {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract fun getFoo(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
// Static members
public final /*synthesized*/ fun B(/*0*/ function: () -> kotlin.Int): A0.B
}
public open class B {
public constructor B()
public open fun getFoo(): kotlin.Int
public open class C {
public constructor C()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open fun getFoo(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
public open class D {
public constructor D()
public open fun getFoo(): kotlin.Int
}
@@ -1,5 +1,8 @@
package
public/*package*/ /*synthesized*/ fun A(/*0*/ function: () -> kotlin.Unit): A
public/*package*/ /*synthesized*/ fun C(/*0*/ function: () -> kotlin.Unit): C
public/*package*/ interface A {
public abstract fun foo(): kotlin.Unit
}