FE: add test for KT-47473

This commit is contained in:
Mikhail Glukhikh
2022-09-14 09:29:25 +02:00
committed by Space
parent b53a6beb61
commit 8c475750b1
7 changed files with 66 additions and 0 deletions
@@ -39181,6 +39181,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
public void testTypeAliasSamAdapterConstructors2() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/typealias/typeAliasSamAdapterConstructors2.kt");
}
@Test
@TestMetadata("upperBoundViolated.kt")
public void testUpperBoundViolated() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/typealias/upperBoundViolated.kt");
}
}
@Nested
@@ -39245,6 +39245,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
public void testTypeAliasSamAdapterConstructors2() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/typealias/typeAliasSamAdapterConstructors2.kt");
}
@Test
@TestMetadata("upperBoundViolated.kt")
public void testUpperBoundViolated() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/typealias/upperBoundViolated.kt");
}
}
@Nested
@@ -39245,6 +39245,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
public void testTypeAliasSamAdapterConstructors2() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/typealias/typeAliasSamAdapterConstructors2.kt");
}
@Test
@TestMetadata("upperBoundViolated.kt")
public void testUpperBoundViolated() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/typealias/upperBoundViolated.kt");
}
}
@Nested
@@ -0,0 +1,10 @@
class NumColl<T : Collection<Number>>
typealias NumList<T2> = NumColl<List<T2>>
typealias AliasOfNumList<A3> = NumList<A3>
val falseUpperBoundViolation = AliasOfNumList<Int>() // Shouldn't be error
val missedUpperBoundViolation = <!UPPER_BOUND_VIOLATED!>NumList<Any>()<!> // Should be error
class Base<T : List<CharSequence>>
typealias Alias<T> = Base<List<T>>
val a = <!UPPER_BOUND_VIOLATED!>Alias<Any>()<!> // Also should be error
@@ -0,0 +1,10 @@
class NumColl<T : Collection<Number>>
typealias NumList<T2> = NumColl<List<T2>>
typealias AliasOfNumList<A3> = NumList<A3>
val falseUpperBoundViolation = AliasOfNumList<<!UPPER_BOUND_VIOLATED!>Int<!>>() // Shouldn't be error
val missedUpperBoundViolation = NumList<Any>() // Should be error
class Base<T : List<CharSequence>>
typealias Alias<T> = Base<List<T>>
val a = Alias<Any>() // Also should be error
@@ -0,0 +1,22 @@
package
public val a: Alias<kotlin.Any> /* = Base<kotlin.collections.List<kotlin.Any>> */
public val falseUpperBoundViolation: AliasOfNumList<kotlin.Int> /* = NumColl<kotlin.collections.List<kotlin.Int>> */
public val missedUpperBoundViolation: NumList<kotlin.Any> /* = NumColl<kotlin.collections.List<kotlin.Any>> */
public final class Base</*0*/ T : kotlin.collections.List<kotlin.CharSequence>> {
public constructor Base</*0*/ T : kotlin.collections.List<kotlin.CharSequence>>()
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 NumColl</*0*/ T : kotlin.collections.Collection<kotlin.Number>> {
public constructor NumColl</*0*/ T : kotlin.collections.Collection<kotlin.Number>>()
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 typealias Alias</*0*/ T> = Base<kotlin.collections.List<T>>
public typealias AliasOfNumList</*0*/ A3> = NumList<A3>
public typealias NumList</*0*/ T2> = NumColl<kotlin.collections.List<T2>>
@@ -39335,6 +39335,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
public void testTypeAliasSamAdapterConstructors2() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/typealias/typeAliasSamAdapterConstructors2.kt");
}
@Test
@TestMetadata("upperBoundViolated.kt")
public void testUpperBoundViolated() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/typealias/upperBoundViolated.kt");
}
}
@Nested