Add test for ExpectedTypeFromCast feature
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
// !LANGUAGE: +ExpectedTypeFromCast
|
||||||
|
|
||||||
|
fun <T> foo(): T = TODO()
|
||||||
|
|
||||||
|
class A {
|
||||||
|
fun <T> fooA(): T = TODO()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <V> id(value: V) = value
|
||||||
|
|
||||||
|
val asA = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>().<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>fooA<!>() as A
|
||||||
|
|
||||||
|
val receiverParenthesized = (<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>()).<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>fooA<!>() as A
|
||||||
|
val no2A = A().<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>fooA<!>().<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>fooA<!>() as A
|
||||||
|
|
||||||
|
val correct1 = A().fooA() as A
|
||||||
|
val correct2 = foo<A>().fooA() as A
|
||||||
|
val correct3 = A().fooA<A>().fooA() as A
|
||||||
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public val asA: A
|
||||||
|
public val correct1: A
|
||||||
|
public val correct2: A
|
||||||
|
public val correct3: A
|
||||||
|
public val no2A: A
|
||||||
|
public val receiverParenthesized: A
|
||||||
|
public fun </*0*/ T> foo(): T
|
||||||
|
public fun </*0*/ V> id(/*0*/ value: V): V
|
||||||
|
|
||||||
|
public final class A {
|
||||||
|
public constructor A()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun </*0*/ T> fooA(): T
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -10228,6 +10228,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("expectedTypeDoubleReceiver.kt")
|
||||||
|
public void testExpectedTypeDoubleReceiver() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/expectedTypeDoubleReceiver.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("expectedTypeFromCast.kt")
|
@TestMetadata("expectedTypeFromCast.kt")
|
||||||
public void testExpectedTypeFromCast() throws Exception {
|
public void testExpectedTypeFromCast() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/expectedTypeFromCast.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/expectedTypeFromCast.kt");
|
||||||
|
|||||||
+6
@@ -10228,6 +10228,12 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("expectedTypeDoubleReceiver.kt")
|
||||||
|
public void testExpectedTypeDoubleReceiver() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/expectedTypeDoubleReceiver.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("expectedTypeFromCast.kt")
|
@TestMetadata("expectedTypeFromCast.kt")
|
||||||
public void testExpectedTypeFromCast() throws Exception {
|
public void testExpectedTypeFromCast() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/expectedTypeFromCast.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/inference/expectedTypeFromCast.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user