Tests for type alias diagnostics: type parameter bound violation in type alias constructor
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
class Num<T: Number>(val x: T)
|
||||
|
||||
typealias N<T> = Num<T>
|
||||
typealias N2<T> = N<T>
|
||||
|
||||
val x1 = Num<<!UPPER_BOUND_VIOLATED!>String<!>>("")
|
||||
val x2 = N<<!UPPER_BOUND_VIOLATED!>String<!>>("")
|
||||
val x3 = N2<<!UPPER_BOUND_VIOLATED!>String<!>>("")
|
||||
|
||||
class TColl<T, C : Collection<T>>
|
||||
|
||||
typealias TC<T, C> = TColl<T, C>
|
||||
typealias TC2<T, C> = TC<T, C>
|
||||
|
||||
val y1 = TColl<Any, <!UPPER_BOUND_VIOLATED!>Any<!>>()
|
||||
val y2 = TC<Any, <!UPPER_BOUND_VIOLATED!>Any<!>>()
|
||||
val y3 = TC2<Any, <!UPPER_BOUND_VIOLATED!>Any<!>>()
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package
|
||||
|
||||
public typealias N</*0*/ T> = Num<T>
|
||||
public typealias N2</*0*/ T> = N<T>
|
||||
public typealias TC</*0*/ T, /*1*/ C> = TColl<T, C>
|
||||
public typealias TC2</*0*/ T, /*1*/ C> = TC<T, C>
|
||||
public val x1: Num<kotlin.String>
|
||||
public val x2: Num<kotlin.String>
|
||||
public val x3: Num<kotlin.String>
|
||||
public val y1: TColl<kotlin.Any, kotlin.Any>
|
||||
public val y2: TColl<kotlin.Any, kotlin.Any>
|
||||
public val y3: TColl<kotlin.Any, kotlin.Any>
|
||||
|
||||
public final class Num</*0*/ T : kotlin.Number> {
|
||||
public constructor Num</*0*/ T : kotlin.Number>(/*0*/ x: T)
|
||||
public final val 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
|
||||
}
|
||||
|
||||
public final class TColl</*0*/ T, /*1*/ C : kotlin.collections.Collection<T>> {
|
||||
public constructor TColl</*0*/ T, /*1*/ C : kotlin.collections.Collection<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
|
||||
}
|
||||
@@ -19425,6 +19425,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/typealias"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("boundViolationInTypeAliasConstructor.kt")
|
||||
public void testBoundViolationInTypeAliasConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/boundViolationInTypeAliasConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("boundsViolationInDeepTypeAliasExpansion.kt")
|
||||
public void testBoundsViolationInDeepTypeAliasExpansion() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/boundsViolationInDeepTypeAliasExpansion.kt");
|
||||
|
||||
Reference in New Issue
Block a user