From b69fb6779fde6957b50410349d080d3cd49312c5 Mon Sep 17 00:00:00 2001 From: Victor Petukhov Date: Thu, 21 Oct 2021 14:23:25 +0300 Subject: [PATCH] Basic support of partially specified type arguments though a new underscore operator for type arguments ^KT-13394 --- ...CompilerTestFE10TestdataTestGenerated.java | 6 + ...irOldFrontendDiagnosticsTestGenerated.java | 6 + ...DiagnosticsWithLightTreeTestGenerated.java | 6 + .../FirBlackBoxCodegenTestGenerated.java | 40 +++ .../kotlin/checkers/utils/DebugInfoUtil.kt | 2 +- .../resolve/calls/tower/NewCallArguments.kt | 16 +- .../resolve/calls/tower/PSICallResolver.kt | 7 +- .../kotlin/psi/KtNameReferenceExpression.kt | 3 + .../jetbrains/kotlin/psi/KtTypeReference.kt | 5 +- .../calls/model/KotlinCallArguments.kt | 2 +- .../underscoredTypeArguments/backTicked.kt | 10 + .../dependentTypeParameters.kt | 21 ++ .../lambdaInputType.kt | 11 + .../box/underscoredTypeArguments/react.kt | 27 ++ .../box/underscoredTypeArguments/simple.kt | 10 + .../illegalUnderscoredTypeArgument.fir.kt | 10 + .../illegalUnderscoredTypeArgument.kt | 10 + .../illegalUnderscoredTypeArgument.txt | 11 + .../psi/UnderscoredTypeArgumentsOfCall.kt | 6 + .../psi/UnderscoredTypeArgumentsOfCall.txt | 140 ++++++++ .../UnderscoredTypeArgumentsOfCallIllegal.kt | 6 + .../UnderscoredTypeArgumentsOfCallIllegal.txt | 134 +++++++ .../psi/UnderscoredTypeArgumentsOfType.kt | 14 + .../psi/UnderscoredTypeArgumentsOfType.txt | 326 ++++++++++++++++++ .../testData/psi/UnderscoredTypeParameters.kt | 7 + .../psi/UnderscoredTypeParameters.txt | 108 ++++++ .../test/runners/DiagnosticTestGenerated.java | 6 + .../codegen/BlackBoxCodegenTestGenerated.java | 40 +++ .../IrBlackBoxCodegenTestGenerated.java | 40 +++ .../LightAnalysisModeTestGenerated.java | 38 ++ .../kotlin/parsing/ParsingTestGenerated.java | 20 ++ .../IrJsCodegenBoxES6TestGenerated.java | 33 ++ .../IrJsCodegenBoxTestGenerated.java | 33 ++ .../IrCodegenBoxWasmTestGenerated.java | 33 ++ .../js/testNew/JsCodegenBoxTestGenerated.java | 34 ++ 35 files changed, 1212 insertions(+), 9 deletions(-) create mode 100644 compiler/testData/codegen/box/underscoredTypeArguments/backTicked.kt create mode 100644 compiler/testData/codegen/box/underscoredTypeArguments/dependentTypeParameters.kt create mode 100644 compiler/testData/codegen/box/underscoredTypeArguments/lambdaInputType.kt create mode 100644 compiler/testData/codegen/box/underscoredTypeArguments/react.kt create mode 100644 compiler/testData/codegen/box/underscoredTypeArguments/simple.kt create mode 100644 compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.fir.kt create mode 100644 compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.kt create mode 100644 compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.txt create mode 100644 compiler/testData/psi/UnderscoredTypeArgumentsOfCall.kt create mode 100644 compiler/testData/psi/UnderscoredTypeArgumentsOfCall.txt create mode 100644 compiler/testData/psi/UnderscoredTypeArgumentsOfCallIllegal.kt create mode 100644 compiler/testData/psi/UnderscoredTypeArgumentsOfCallIllegal.txt create mode 100644 compiler/testData/psi/UnderscoredTypeArgumentsOfType.kt create mode 100644 compiler/testData/psi/UnderscoredTypeArgumentsOfType.txt create mode 100644 compiler/testData/psi/UnderscoredTypeParameters.kt create mode 100644 compiler/testData/psi/UnderscoredTypeParameters.txt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index 508d1d4bc08..74b8a8c8f91 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -13077,6 +13077,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt"); } + @Test + @TestMetadata("illegalUnderscoredTypeArgument.kt") + public void testIllegalUnderscoredTypeArgument() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.kt"); + } + @Test @TestMetadata("immutableArrayList.kt") public void testImmutableArrayList() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index 0009b947ca8..aaef0330d27 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -13077,6 +13077,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt"); } + @Test + @TestMetadata("illegalUnderscoredTypeArgument.kt") + public void testIllegalUnderscoredTypeArgument() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.kt"); + } + @Test @TestMetadata("immutableArrayList.kt") public void testImmutableArrayList() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java index cbba43406b1..3f07792f587 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java @@ -13077,6 +13077,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt"); } + @Test + @TestMetadata("illegalUnderscoredTypeArgument.kt") + public void testIllegalUnderscoredTypeArgument() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.kt"); + } + @Test @TestMetadata("immutableArrayList.kt") public void testImmutableArrayList() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index b6ff5922c46..6a0ab443031 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -43655,6 +43655,46 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } } + @Nested + @TestMetadata("compiler/testData/codegen/box/underscoredTypeArguments") + @TestDataPath("$PROJECT_ROOT") + public class UnderscoredTypeArguments { + @Test + public void testAllFilesPresentInUnderscoredTypeArguments() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/underscoredTypeArguments"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("backTicked.kt") + public void testBackTicked() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/backTicked.kt"); + } + + @Test + @TestMetadata("dependentTypeParameters.kt") + public void testDependentTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/dependentTypeParameters.kt"); + } + + @Test + @TestMetadata("lambdaInputType.kt") + public void testLambdaInputType() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/lambdaInputType.kt"); + } + + @Test + @TestMetadata("react.kt") + public void testReact() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/react.kt"); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/simple.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/unit") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/DebugInfoUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/DebugInfoUtil.kt index 78fb6c58907..56f44c7e408 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/DebugInfoUtil.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/checkers/utils/DebugInfoUtil.kt @@ -150,7 +150,7 @@ object DebugInfoUtil { target = "[" + labelTargets.size + " elements]" } } - if (MAY_BE_UNRESOLVED.contains(referencedNameElementType)) { + if (MAY_BE_UNRESOLVED.contains(referencedNameElementType) || (expression is KtNameReferenceExpression && expression.isPlaceholder)) { return } val resolved = target != null diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewCallArguments.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewCallArguments.kt index 90d8ffdad56..68de07e4755 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewCallArguments.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewCallArguments.kt @@ -286,16 +286,24 @@ private fun resolveParametersTypes( } } +@JvmName("resolveTypeWithGivenTypeReference") +internal fun resolveType( + context: BasicCallResolutionContext, + typeReference: KtTypeReference, + typeResolver: TypeResolver +): UnwrappedType { + val type = typeResolver.resolveType(context.scope, typeReference, context.trace, checkBounds = true) + ForceResolveUtil.forceResolveAllContents(type) + return type.unwrap() +} + internal fun resolveType( context: BasicCallResolutionContext, typeReference: KtTypeReference?, typeResolver: TypeResolver ): UnwrappedType? { if (typeReference == null) return null - - val type = typeResolver.resolveType(context.scope, typeReference, context.trace, checkBounds = true) - ForceResolveUtil.forceResolveAllContents(type) - return type.unwrap() + return resolveType(context, typeReference, typeResolver) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt index c64f78131d3..b46fa112350 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/PSICallResolver.kt @@ -687,8 +687,11 @@ class PSICallResolver( } ModifierCheckerCore.check(projection, context.trace, null, languageVersionSettings) - resolveType(context, projection.typeReference, typeResolver)?.let { SimpleTypeArgumentImpl(projection, it) } - ?: TypeArgumentPlaceholder + val typeReference = projection.typeReference + + if (typeReference == null || typeReference.isPlaceholder) return@map TypeArgumentPlaceholder + + SimpleTypeArgumentImpl(projection, resolveType(context, typeReference, typeResolver)) } private fun resolveArgumentsInParenthesis( diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtNameReferenceExpression.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/KtNameReferenceExpression.kt index 85a7b625259..ece696695a9 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtNameReferenceExpression.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtNameReferenceExpression.kt @@ -59,6 +59,9 @@ class KtNameReferenceExpression : KtExpressionImplStub()?.isPlaceholder == true + val typeElement: KtTypeElement? get() = KtStubbedPsiUtil.getStubOrPsiChild(this, KtStubElementTypes.TYPE_ELEMENT_TYPES, KtTypeElement.ARRAY_FACTORY) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallArguments.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallArguments.kt index a88c2d91a7b..e8aecf27185 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallArguments.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallArguments.kt @@ -133,7 +133,7 @@ interface CollectionLiteralKotlinCallArgument : PostponableKotlinCallArgument interface TypeArgument -// todo allow '_' in frontend +// Used as a stub or underscored type argument object TypeArgumentPlaceholder : TypeArgument interface SimpleTypeArgument : TypeArgument { diff --git a/compiler/testData/codegen/box/underscoredTypeArguments/backTicked.kt b/compiler/testData/codegen/box/underscoredTypeArguments/backTicked.kt new file mode 100644 index 00000000000..efffc595e0b --- /dev/null +++ b/compiler/testData/codegen/box/underscoredTypeArguments/backTicked.kt @@ -0,0 +1,10 @@ +// WITH_RUNTIME + +fun foo(x: (K) -> T): Pair = (1 as K) to (1f as T) + +class `_` {} + +fun box(): String { + val x1 = foo { it.toFloat() as `_` } // Pair + return "OK" +} diff --git a/compiler/testData/codegen/box/underscoredTypeArguments/dependentTypeParameters.kt b/compiler/testData/codegen/box/underscoredTypeArguments/dependentTypeParameters.kt new file mode 100644 index 00000000000..35ab82e6309 --- /dev/null +++ b/compiler/testData/codegen/box/underscoredTypeArguments/dependentTypeParameters.kt @@ -0,0 +1,21 @@ +// WITH_RUNTIME +// TARGET_BACKEND: JVM + +abstract class SomeClass { + abstract fun execute() : T +} + +class SomeImplementation : SomeClass() { + override fun execute(): String = "Test" +} + +object Runner { + inline fun , T> run() : T { + return S::class.java.newInstance().execute() + } +} + +fun box(): String { + val s = Runner.run() // T is inferred to String + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/underscoredTypeArguments/lambdaInputType.kt b/compiler/testData/codegen/box/underscoredTypeArguments/lambdaInputType.kt new file mode 100644 index 00000000000..6b52a98a6d9 --- /dev/null +++ b/compiler/testData/codegen/box/underscoredTypeArguments/lambdaInputType.kt @@ -0,0 +1,11 @@ +sealed class MyResult{ + data class Success(val value: T): MyResult() + data class Failure(val exception: Throwable): MyResult() +} + +inline fun MyResult.catch(result: (E) -> T) = "OK" + +fun box(): String { + val result: MyResult = MyResult.Success(1) + return result.catch{ 2 } // T is inferred into Int +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/underscoredTypeArguments/react.kt b/compiler/testData/codegen/box/underscoredTypeArguments/react.kt new file mode 100644 index 00000000000..96fc27aed84 --- /dev/null +++ b/compiler/testData/codegen/box/underscoredTypeArguments/react.kt @@ -0,0 +1,27 @@ +interface RProps +open class RComponent : Component +interface RState +interface Component +class RElementBuilder +interface ReactElement + +class RBuilder + +interface MyProps : RProps { + var list: List +} + +class MyComponent : RComponent, RState>() {} + +inline fun

> child( + noinline handler: RElementBuilder

.() -> Unit +): String = "OK" + +fun box(): String { + child Unit>, _> { + + } + return child<_, MyComponent Unit>> { + + } +} diff --git a/compiler/testData/codegen/box/underscoredTypeArguments/simple.kt b/compiler/testData/codegen/box/underscoredTypeArguments/simple.kt new file mode 100644 index 00000000000..6e127f60c34 --- /dev/null +++ b/compiler/testData/codegen/box/underscoredTypeArguments/simple.kt @@ -0,0 +1,10 @@ +// WITH_RUNTIME + +fun foo(x: (K) -> T): Pair = (1 as K) to (1f as T) + +//class `_` {} + +fun box(): String { + val x = foo { it.toFloat() } // Pair + return "OK" +} diff --git a/compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.fir.kt b/compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.fir.kt new file mode 100644 index 00000000000..5a41685b0ab --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.fir.kt @@ -0,0 +1,10 @@ +// WITH_RUNTIME + +fun foo(x: (K) -> T): Pair = TODO() + +class Foo + +fun main() { + val x = foo> { it.toFloat() } + +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.kt b/compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.kt new file mode 100644 index 00000000000..20635ada35a --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.kt @@ -0,0 +1,10 @@ +// WITH_RUNTIME + +fun foo(x: (K) -> T): Pair = TODO() + +class Foo + +fun main() { + val x = foo_>> { it.toFloat() } + +} diff --git a/compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.txt b/compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.txt new file mode 100644 index 00000000000..e5d79ba1c53 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.txt @@ -0,0 +1,11 @@ +package + +public fun foo(/*0*/ x: (K) -> T): kotlin.Pair +public fun main(): kotlin.Unit + +public final class Foo { + public constructor Foo() + 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 +} diff --git a/compiler/testData/psi/UnderscoredTypeArgumentsOfCall.kt b/compiler/testData/psi/UnderscoredTypeArgumentsOfCall.kt new file mode 100644 index 00000000000..661b036fe01 --- /dev/null +++ b/compiler/testData/psi/UnderscoredTypeArgumentsOfCall.kt @@ -0,0 +1,6 @@ +fun main() { + val x = foo() + val x = foo<_, _, _>() + val x = foo<_, _, Int>() + val x = foo<_>() +} diff --git a/compiler/testData/psi/UnderscoredTypeArgumentsOfCall.txt b/compiler/testData/psi/UnderscoredTypeArgumentsOfCall.txt new file mode 100644 index 00000000000..70516b2ba0f --- /dev/null +++ b/compiler/testData/psi/UnderscoredTypeArgumentsOfCall.txt @@ -0,0 +1,140 @@ +KtFile: UnderscoredTypeArgumentsOfCall.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('main') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/UnderscoredTypeArgumentsOfCallIllegal.kt b/compiler/testData/psi/UnderscoredTypeArgumentsOfCallIllegal.kt new file mode 100644 index 00000000000..d7098d9971e --- /dev/null +++ b/compiler/testData/psi/UnderscoredTypeArgumentsOfCallIllegal.kt @@ -0,0 +1,6 @@ +fun main() { + val y: Foo<__> = 1 + val y: Foo<_, __> = 1 + val y: Foo = 1 + val y: Foo<_____, Float> = 1 +} diff --git a/compiler/testData/psi/UnderscoredTypeArgumentsOfCallIllegal.txt b/compiler/testData/psi/UnderscoredTypeArgumentsOfCallIllegal.txt new file mode 100644 index 00000000000..739077b791d --- /dev/null +++ b/compiler/testData/psi/UnderscoredTypeArgumentsOfCallIllegal.txt @@ -0,0 +1,134 @@ +KtFile: UnderscoredTypeArgumentsOfCallIllegal.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('main') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('y') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('__') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('y') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('__') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('y') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('__') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('y') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_____') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Float') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/UnderscoredTypeArgumentsOfType.kt b/compiler/testData/psi/UnderscoredTypeArgumentsOfType.kt new file mode 100644 index 00000000000..e4b81a810d8 --- /dev/null +++ b/compiler/testData/psi/UnderscoredTypeArgumentsOfType.kt @@ -0,0 +1,14 @@ +fun main() { + val x = foo>() + val x = foo, _>() + val x = foo, Int>() + val x = foo>() + val x = foo, Float>, Float>() + + val y: Foo<_> = 1 + val y: Foo<_, _> = 1 +} + +interface A : Foo<_> + +typealias Foo = Foo<_, K> diff --git a/compiler/testData/psi/UnderscoredTypeArgumentsOfType.txt b/compiler/testData/psi/UnderscoredTypeArgumentsOfType.txt new file mode 100644 index 00000000000..fd7e6f45bbd --- /dev/null +++ b/compiler/testData/psi/UnderscoredTypeArgumentsOfType.txt @@ -0,0 +1,326 @@ +KtFile: UnderscoredTypeArgumentsOfType.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('main') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(GT)('>') + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(GT)('>') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(GT)('>') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(GT)('>') + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(GT)('>') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Float') + PsiElement(GT)('>') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Float') + PsiElement(GT)('>') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('y') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('y') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + CLASS + PsiElement(interface)('interface') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + SUPER_TYPE_LIST + SUPER_TYPE_ENTRY + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(GT)('>') + PsiWhiteSpace('\n\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Foo') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('K') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('_') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('K') + PsiElement(GT)('>') \ No newline at end of file diff --git a/compiler/testData/psi/UnderscoredTypeParameters.kt b/compiler/testData/psi/UnderscoredTypeParameters.kt new file mode 100644 index 00000000000..d6ed84e32ac --- /dev/null +++ b/compiler/testData/psi/UnderscoredTypeParameters.kt @@ -0,0 +1,7 @@ +class A<_> {} + +typealias Foo = Foo + +fun foo() {} + +fun foo() {} diff --git a/compiler/testData/psi/UnderscoredTypeParameters.txt b/compiler/testData/psi/UnderscoredTypeParameters.txt new file mode 100644 index 00000000000..e5851e4322a --- /dev/null +++ b/compiler/testData/psi/UnderscoredTypeParameters.txt @@ -0,0 +1,108 @@ +KtFile: UnderscoredTypeParameters.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + CLASS + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('_') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + TYPEALIAS + PsiElement(typealias)('typealias') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Foo') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('K') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('_') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Foo') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('K') + PsiElement(GT)('>') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('K') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('_') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('T') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('K') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('_') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('K') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 48d6684d09a..88ea4fbb9cc 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -13083,6 +13083,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt"); } + @Test + @TestMetadata("illegalUnderscoredTypeArgument.kt") + public void testIllegalUnderscoredTypeArgument() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/illegalUnderscoredTypeArgument.kt"); + } + @Test @TestMetadata("immutableArrayList.kt") public void testImmutableArrayList() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index d5f211199e0..0efcb97abad 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -43487,6 +43487,46 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/underscoredTypeArguments") + @TestDataPath("$PROJECT_ROOT") + public class UnderscoredTypeArguments { + @Test + public void testAllFilesPresentInUnderscoredTypeArguments() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/underscoredTypeArguments"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Test + @TestMetadata("backTicked.kt") + public void testBackTicked() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/backTicked.kt"); + } + + @Test + @TestMetadata("dependentTypeParameters.kt") + public void testDependentTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/dependentTypeParameters.kt"); + } + + @Test + @TestMetadata("lambdaInputType.kt") + public void testLambdaInputType() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/lambdaInputType.kt"); + } + + @Test + @TestMetadata("react.kt") + public void testReact() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/react.kt"); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/simple.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/unit") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 21a5f397f2c..7b885e92ee1 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -43655,6 +43655,46 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/underscoredTypeArguments") + @TestDataPath("$PROJECT_ROOT") + public class UnderscoredTypeArguments { + @Test + public void testAllFilesPresentInUnderscoredTypeArguments() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/underscoredTypeArguments"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("backTicked.kt") + public void testBackTicked() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/backTicked.kt"); + } + + @Test + @TestMetadata("dependentTypeParameters.kt") + public void testDependentTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/dependentTypeParameters.kt"); + } + + @Test + @TestMetadata("lambdaInputType.kt") + public void testLambdaInputType() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/lambdaInputType.kt"); + } + + @Test + @TestMetadata("react.kt") + public void testReact() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/react.kt"); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/simple.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/unit") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index b045735fcb5..f0e1cb0b011 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -35099,6 +35099,44 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/underscoredTypeArguments") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnderscoredTypeArguments extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInUnderscoredTypeArguments() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/underscoredTypeArguments"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("backTicked.kt") + public void testBackTicked() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/backTicked.kt"); + } + + @TestMetadata("dependentTypeParameters.kt") + public void testDependentTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/dependentTypeParameters.kt"); + } + + @TestMetadata("lambdaInputType.kt") + public void testLambdaInputType() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/lambdaInputType.kt"); + } + + @TestMetadata("react.kt") + public void testReact() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/react.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/simple.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/unit") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-gen/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java index e99472fde4e..16771026f67 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java @@ -731,6 +731,26 @@ public class ParsingTestGenerated extends AbstractParsingTest { runTest("compiler/testData/psi/TypealiasIsKeyword.kt"); } + @TestMetadata("UnderscoredTypeArgumentsOfCall.kt") + public void testUnderscoredTypeArgumentsOfCall() throws Exception { + runTest("compiler/testData/psi/UnderscoredTypeArgumentsOfCall.kt"); + } + + @TestMetadata("UnderscoredTypeArgumentsOfCallIllegal.kt") + public void testUnderscoredTypeArgumentsOfCallIllegal() throws Exception { + runTest("compiler/testData/psi/UnderscoredTypeArgumentsOfCallIllegal.kt"); + } + + @TestMetadata("UnderscoredTypeArgumentsOfType.kt") + public void testUnderscoredTypeArgumentsOfType() throws Exception { + runTest("compiler/testData/psi/UnderscoredTypeArgumentsOfType.kt"); + } + + @TestMetadata("UnderscoredTypeParameters.kt") + public void testUnderscoredTypeParameters() throws Exception { + runTest("compiler/testData/psi/UnderscoredTypeParameters.kt"); + } + @TestMetadata("UnsignedLiteral.kt") public void testUnsignedLiteral() throws Exception { runTest("compiler/testData/psi/UnsignedLiteral.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 0adca1bcfdd..5b787fc069b 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -28999,6 +28999,39 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } } + @TestMetadata("compiler/testData/codegen/box/underscoredTypeArguments") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnderscoredTypeArguments extends AbstractIrJsCodegenBoxES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInUnderscoredTypeArguments() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/underscoredTypeArguments"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + + @TestMetadata("backTicked.kt") + public void testBackTicked() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/backTicked.kt"); + } + + @TestMetadata("lambdaInputType.kt") + public void testLambdaInputType() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/lambdaInputType.kt"); + } + + @TestMetadata("react.kt") + public void testReact() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/react.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/simple.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/unit") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 7d36defa427..5487cf9bb0a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -28405,6 +28405,39 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/underscoredTypeArguments") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnderscoredTypeArguments extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInUnderscoredTypeArguments() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/underscoredTypeArguments"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @TestMetadata("backTicked.kt") + public void testBackTicked() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/backTicked.kt"); + } + + @TestMetadata("lambdaInputType.kt") + public void testLambdaInputType() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/lambdaInputType.kt"); + } + + @TestMetadata("react.kt") + public void testReact() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/react.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/simple.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/unit") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index a4f4ad140fe..dc2f06b7db7 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -24731,6 +24731,39 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest } } + @TestMetadata("compiler/testData/codegen/box/underscoredTypeArguments") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class UnderscoredTypeArguments extends AbstractIrCodegenBoxWasmTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); + } + + public void testAllFilesPresentInUnderscoredTypeArguments() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/underscoredTypeArguments"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + + @TestMetadata("backTicked.kt") + public void testBackTicked() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/backTicked.kt"); + } + + @TestMetadata("lambdaInputType.kt") + public void testLambdaInputType() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/lambdaInputType.kt"); + } + + @TestMetadata("react.kt") + public void testReact() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/react.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/simple.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/unit") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testNew/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testNew/JsCodegenBoxTestGenerated.java index 840af4df2c4..c62093ea036 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testNew/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testNew/JsCodegenBoxTestGenerated.java @@ -31537,6 +31537,40 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/underscoredTypeArguments") + @TestDataPath("$PROJECT_ROOT") + public class UnderscoredTypeArguments { + @Test + public void testAllFilesPresentInUnderscoredTypeArguments() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/underscoredTypeArguments"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @Test + @TestMetadata("backTicked.kt") + public void testBackTicked() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/backTicked.kt"); + } + + @Test + @TestMetadata("lambdaInputType.kt") + public void testLambdaInputType() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/lambdaInputType.kt"); + } + + @Test + @TestMetadata("react.kt") + public void testReact() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/react.kt"); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/codegen/box/underscoredTypeArguments/simple.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/unit") @TestDataPath("$PROJECT_ROOT")