FIC: Add diagnostic tests
This commit is contained in:
+10
@@ -7823,6 +7823,16 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok
|
|||||||
public void testBasicFunInterfaceDisabled() throws Exception {
|
public void testBasicFunInterfaceDisabled() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/funInterface/basicFunInterfaceDisabled.kt");
|
runTest("compiler/testData/diagnostics/tests/funInterface/basicFunInterfaceDisabled.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("genericSubstitutionForFunInterface.kt")
|
||||||
|
public void testGenericSubstitutionForFunInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/funInterface/genericSubstitutionForFunInterface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("severalConversionsForFunInterface.kt")
|
||||||
|
public void testSeveralConversionsForFunInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/funInterface/severalConversionsForFunInterface.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/functionAsExpression")
|
@TestMetadata("compiler/testData/diagnostics/tests/functionAsExpression")
|
||||||
|
|||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
// !LANGUAGE: +NewInference +SamConversionForKotlinFunctions +SamConversionPerArgument +FunctionInterfaceConversion
|
||||||
|
// !CHECK_TYPE
|
||||||
|
|
||||||
|
fun interface F<S> {
|
||||||
|
fun apply(s: S)
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PR<X, Y> {}
|
||||||
|
|
||||||
|
interface K<T> {
|
||||||
|
fun f_t(f1: F<T>, f2: F<T>)
|
||||||
|
fun <R> f_r(f1: F<R>, f2: F<R>)
|
||||||
|
fun <R> f_pr(f1: F<PR<T, R>>, f2: F<PR<T, R>>)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test(
|
||||||
|
k: K<String>,
|
||||||
|
f_string: F<String>,
|
||||||
|
f_int: F<Int>,
|
||||||
|
f_pr: F<PR<String, Int>>
|
||||||
|
) {
|
||||||
|
k.f_t(f_string) { it checkType { _<String>() } }
|
||||||
|
k.f_r(f_int) { it checkType { _<Int>() } }
|
||||||
|
k.f_pr(f_pr) { it checkType { _<PR<String, Int>>() } }
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun test(/*0*/ k: K<kotlin.String>, /*1*/ f_string: F<kotlin.String>, /*2*/ f_int: F<kotlin.Int>, /*3*/ f_pr: F<PR<kotlin.String, kotlin.Int>>): kotlin.Unit
|
||||||
|
|
||||||
|
public interface F</*0*/ S> {
|
||||||
|
public abstract fun apply(/*0*/ s: S): kotlin.Unit
|
||||||
|
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 interface K</*0*/ T> {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract fun </*0*/ R> f_pr(/*0*/ f1: F<PR<T, R>>, /*1*/ f2: F<PR<T, R>>): kotlin.Unit
|
||||||
|
public abstract fun </*0*/ R> f_r(/*0*/ f1: F<R>, /*1*/ f2: F<R>): kotlin.Unit
|
||||||
|
public abstract fun f_t(/*0*/ f1: F<T>, /*1*/ f2: F<T>): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface PR</*0*/ X, /*1*/ Y> {
|
||||||
|
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
|
||||||
|
}
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
// !LANGUAGE: +NewInference +SamConversionForKotlinFunctions +SamConversionPerArgument +FunctionInterfaceConversion
|
||||||
|
|
||||||
|
interface J {
|
||||||
|
fun foo1(r: KRunnable)
|
||||||
|
|
||||||
|
fun foo2(r1: KRunnable, r2: KRunnable)
|
||||||
|
|
||||||
|
fun foo3(r1: KRunnable, r2: KRunnable, r3: KRunnable)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun interface KRunnable {
|
||||||
|
fun run()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: 1.kt
|
||||||
|
fun test(j: J, r: KRunnable) {
|
||||||
|
j.foo1(r)
|
||||||
|
j.foo1({})
|
||||||
|
|
||||||
|
j.foo2(r, r)
|
||||||
|
j.foo2({}, {})
|
||||||
|
j.foo2(r, {})
|
||||||
|
j.foo2({}, r)
|
||||||
|
|
||||||
|
j.foo3(r, r, r)
|
||||||
|
j.foo3(r, r, {})
|
||||||
|
j.foo3(r, {}, r)
|
||||||
|
j.foo3(r, {}, {})
|
||||||
|
j.foo3({}, r, r)
|
||||||
|
j.foo3({}, r, {})
|
||||||
|
j.foo3({}, {}, r)
|
||||||
|
j.foo3({}, {}, {})
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun test(/*0*/ j: J, /*1*/ r: KRunnable): kotlin.Unit
|
||||||
|
|
||||||
|
public interface J {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract fun foo1(/*0*/ r: KRunnable): kotlin.Unit
|
||||||
|
public abstract fun foo2(/*0*/ r1: KRunnable, /*1*/ r2: KRunnable): kotlin.Unit
|
||||||
|
public abstract fun foo3(/*0*/ r1: KRunnable, /*1*/ r2: KRunnable, /*2*/ r3: KRunnable): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface KRunnable {
|
||||||
|
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 abstract fun run(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -7905,6 +7905,16 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
public void testBasicFunInterfaceDisabled() throws Exception {
|
public void testBasicFunInterfaceDisabled() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/funInterface/basicFunInterfaceDisabled.kt");
|
runTest("compiler/testData/diagnostics/tests/funInterface/basicFunInterfaceDisabled.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("genericSubstitutionForFunInterface.kt")
|
||||||
|
public void testGenericSubstitutionForFunInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/funInterface/genericSubstitutionForFunInterface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("severalConversionsForFunInterface.kt")
|
||||||
|
public void testSeveralConversionsForFunInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/funInterface/severalConversionsForFunInterface.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/functionAsExpression")
|
@TestMetadata("compiler/testData/diagnostics/tests/functionAsExpression")
|
||||||
|
|||||||
Generated
+10
@@ -7900,6 +7900,16 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
public void testBasicFunInterfaceDisabled() throws Exception {
|
public void testBasicFunInterfaceDisabled() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/funInterface/basicFunInterfaceDisabled.kt");
|
runTest("compiler/testData/diagnostics/tests/funInterface/basicFunInterfaceDisabled.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("genericSubstitutionForFunInterface.kt")
|
||||||
|
public void testGenericSubstitutionForFunInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/funInterface/genericSubstitutionForFunInterface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("severalConversionsForFunInterface.kt")
|
||||||
|
public void testSeveralConversionsForFunInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/funInterface/severalConversionsForFunInterface.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/functionAsExpression")
|
@TestMetadata("compiler/testData/diagnostics/tests/functionAsExpression")
|
||||||
|
|||||||
Reference in New Issue
Block a user