Tests for type alias diagnostics: wrong number of type arguments in type alias constructor
This commit is contained in:
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
class Pair<T1, T2>(val x1: T1, val x2: T2)
|
||||
|
||||
typealias P<T1, T2> = Pair<T1, T2>
|
||||
|
||||
typealias P2<T> = Pair<T, T>
|
||||
|
||||
typealias PR<T1, T2> = Pair<T2, T1>
|
||||
|
||||
val test0 = <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>P<!>(1, 2)
|
||||
val test1 = P<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!>(1, 2)
|
||||
val test2 = P<Int, Int>(1, 2)
|
||||
val test3 = P<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int, Int, Int><!>(1, 2)
|
||||
|
||||
val test0p2 = <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>P2<!>(1, 1)
|
||||
val test1p2 = P2<Int>(1, 1)
|
||||
val test2p2 = P2<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int, Int><!>(1, 1)
|
||||
val test3p2 = P2<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int, Int, Int><!>(1, 1)
|
||||
|
||||
val test0pr = <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>PR<!>(1, "")
|
||||
val test1pr = PR<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!>(1, <!TYPE_MISMATCH!>""<!>)
|
||||
val test2pr = PR<Int, String>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>, <!TYPE_MISMATCH!>""<!>)
|
||||
val test2pra = PR<String, Int>(1, "")
|
||||
val test3pr = P2<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String, Int, Int><!>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>, "")
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
package
|
||||
|
||||
public typealias P</*0*/ T1, /*1*/ T2> = Pair<T1, T2>
|
||||
public typealias P2</*0*/ T> = Pair<T, T>
|
||||
public typealias PR</*0*/ T1, /*1*/ T2> = Pair<T2, T1>
|
||||
public val test0: Pair<kotlin.Int, kotlin.Int>
|
||||
public val test0p2: Pair<kotlin.Int, kotlin.Int>
|
||||
public val test0pr: Pair<kotlin.Int, kotlin.String>
|
||||
public val test1: Pair<kotlin.Int, [ERROR : Explicit type argument expected for T2]>
|
||||
public val test1p2: Pair<kotlin.Int, kotlin.Int>
|
||||
public val test1pr: Pair<[ERROR : Explicit type argument expected for T2], kotlin.Int>
|
||||
public val test2: Pair<kotlin.Int, kotlin.Int>
|
||||
public val test2p2: Pair<kotlin.Int, kotlin.Int>
|
||||
public val test2pr: Pair<kotlin.String, kotlin.Int>
|
||||
public val test2pra: Pair<kotlin.Int, kotlin.String>
|
||||
public val test3: Pair<kotlin.Int, kotlin.Int>
|
||||
public val test3p2: Pair<kotlin.Int, kotlin.Int>
|
||||
public val test3pr: Pair<kotlin.String, kotlin.String>
|
||||
|
||||
public final class Pair</*0*/ T1, /*1*/ T2> {
|
||||
public constructor Pair</*0*/ T1, /*1*/ T2>(/*0*/ x1: T1, /*1*/ x2: T2)
|
||||
public final val x1: T1
|
||||
public final val x2: T2
|
||||
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
|
||||
}
|
||||
@@ -19580,6 +19580,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/unsupportedTypeAlias.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("wrongNumberOfArgumentsInTypeAliasConstructor.kt")
|
||||
public void testWrongNumberOfArgumentsInTypeAliasConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/wrongNumberOfArgumentsInTypeAliasConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/unit")
|
||||
|
||||
Reference in New Issue
Block a user