Extra test with smart cast to 'T'
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
class Wrapper<T>(var x: T)
|
||||
|
||||
inline fun <reified T> change(w: Wrapper<T>, x: Any?) {
|
||||
if (x is T) {
|
||||
w.x = x
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val w = Wrapper<String>("FAIL")
|
||||
change(w, "OK")
|
||||
return w.x
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Wrapper<T>(var x: T)
|
||||
|
||||
inline fun <reified T> change(w: Wrapper<T>, x: Any?) {
|
||||
if (x is T) {
|
||||
w.x = <!DEBUG_INFO_SMARTCAST!>x<!>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package
|
||||
|
||||
public inline fun </*0*/ reified T> change(/*0*/ w: Wrapper<T>, /*1*/ x: kotlin.Any?): kotlin.Unit
|
||||
|
||||
public final class Wrapper</*0*/ T> {
|
||||
public constructor Wrapper</*0*/ T>(/*0*/ x: T)
|
||||
public final var x: T
|
||||
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
|
||||
}
|
||||
@@ -15615,6 +15615,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("genericSet.kt")
|
||||
public void testGenericSet() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/genericSet.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ifCascadeExprNotNull.kt")
|
||||
public void testIfCascadeExprNotNull() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/ifCascadeExprNotNull.kt");
|
||||
|
||||
+6
@@ -7357,6 +7357,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("genericSet.kt")
|
||||
public void testGenericSet() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/smartCasts/genericSet.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("implicitExtensionReceiver.kt")
|
||||
public void testImplicitExtensionReceiver() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/smartCasts/implicitExtensionReceiver.kt");
|
||||
|
||||
Reference in New Issue
Block a user