Use substituted return type for SAM adapeter of constructor

#KT-7282 Fixed
This commit is contained in:
Denis Zharkov
2015-07-17 12:38:44 +03:00
parent 97af85da9c
commit 58e7923218
4 changed files with 32 additions and 1 deletions
@@ -223,7 +223,7 @@ public class SingleAbstractMethodUtils {
@Nullable JetType returnType
) {
result.initialize(typeParameters, valueParameters, original.getVisibility());
result.setReturnType(result.getContainingDeclaration().getDefaultType());
result.setReturnType(returnType);
}
});
}
@@ -0,0 +1,14 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
// FILE: A.java
import java.util.Comparator;
public class A<E> {
public A(Comparator<? super E> comparator) {}
}
// FILE: main.kt
fun foo() {
val result: A<String> = A<String> { x, y -> 1 }
}
@@ -0,0 +1,11 @@
package
internal fun foo(): kotlin.Unit
public open class A</*0*/ E : kotlin.Any!> {
public /*synthesized*/ constructor A</*0*/ E : kotlin.Any!>(/*0*/ comparator: ((E!, E!) -> kotlin.Int)!)
public constructor A</*0*/ E : kotlin.Any!>(/*0*/ comparator: java.util.Comparator<in E!>!)
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
}
@@ -10059,6 +10059,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("samAdapterInConstructor.kt")
public void testSamAdapterInConstructor() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/samAdapterInConstructor.kt");
doTest(fileName);
}
@TestMetadata("samConstructor.kt")
public void testSamConstructor() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/samConstructor.kt");