CAST_NEVER_SUCCEEDS: some type alias tests (1.1 only!)

This commit is contained in:
Mikhail Glukhikh
2016-08-09 17:31:28 +03:00
parent 687698da9a
commit d21061ff60
3 changed files with 56 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
typealias MyString = String
val x: MyString = ""
val y = x <!USELESS_CAST!>as Any<!>
interface Base
class Derived : Base
interface Other : Base
typealias IBase = Base
typealias IOther = Other
val ib: IBase = Derived()
val d = ib as Derived
val o = ib as Other
val io = ib as IOther
val s = d <!CAST_NEVER_SUCCEEDS!>as<!> String
val ms = d <!CAST_NEVER_SUCCEEDS!>as<!> MyString
@@ -0,0 +1,32 @@
package
public typealias IBase = Base
public typealias IOther = Other
public typealias MyString = kotlin.String
public val d: Derived
public val ib: IBase /* = Base */
public val io: IOther /* = Other */
public val ms: MyString /* = kotlin.String */
public val o: Other
public val s: kotlin.String
public val x: MyString /* = kotlin.String */ = ""
public val y: kotlin.Any = ""
public interface Base {
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 final class Derived : Base {
public constructor Derived()
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 Other : Base {
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
}
@@ -2445,6 +2445,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("AsTypeAlias.kt")
public void testAsTypeAlias() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/cast/AsTypeAlias.kt");
doTest(fileName);
}
@TestMetadata("AsWithOtherParameter.kt")
public void testAsWithOtherParameter() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/cast/AsWithOtherParameter.kt");