diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 943feeabdd5..3aa57020818 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -37112,6 +37112,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt"); } + @Test + @TestMetadata("inferredTypeParameters.kt") + public void testInferredTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt"); + } + @Test @TestMetadata("integralWhenWithNoInlinedConstants.kt") public void testIntegralWhenWithNoInlinedConstants() throws Exception { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index 975966d07ab..1933753b53d 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -126,7 +126,7 @@ object FirErrors { val PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT by error0() val UPPER_BOUND_VIOLATED by error2() val TYPE_ARGUMENTS_NOT_ALLOWED by error0() - val WRONG_NUMBER_OF_TYPE_ARGUMENTS by error2() + val WRONG_NUMBER_OF_TYPE_ARGUMENTS by error2>() val NO_TYPE_FOR_TYPE_PARAMETER by error0() val TYPE_PARAMETERS_IN_OBJECT by error0() val ILLEGAL_PROJECTION_USAGE by error0() diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt index 209f3c17e30..e50a0be8f76 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt @@ -74,7 +74,7 @@ class ConeIllegalAnnotationError(val name: Name) : ConeDiagnostic() { override val reason: String get() = "Not a legal annotation: $name" } -class ConeWrongNumberOfTypeArgumentsError(val desiredCount: Int, val type: FirRegularClassSymbol) : ConeDiagnostic() { +class ConeWrongNumberOfTypeArgumentsError(val desiredCount: Int, val type: FirClassLikeSymbol<*>) : ConeDiagnostic() { override val reason: String get() = "Wrong number of type arguments" } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt index 62c48e0ceb6..0f18e0da2d8 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt @@ -450,30 +450,53 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform override fun shouldRunCompletion(call: T): Boolean where T : FirStatement, T : FirResolvable = false } - private fun FirTypeRef.withTypeArgumentsForBareType(argument: FirExpression): FirTypeRef { - // TODO: Everything should also work for case of checked-type itself is a type alias - val type = coneTypeSafe() - if (type !is ConeClassLikeType || type.typeArguments.isNotEmpty()) { - return this + private fun ConeClassLikeType.inheritTypeArguments( + base: FirClassLikeDeclaration<*>, + arguments: Array + ): Array? { + val firClass = lookupTag.toSymbol(session)?.fir ?: return null + if (firClass !is FirTypeParameterRefsOwner || firClass.typeParameters.isEmpty()) return arrayOf() + return when (firClass) { + base -> arguments + is FirTypeAlias -> firClass.inheritTypeArguments(firClass.expandedTypeRef, base, arguments) + // TODO: if many supertypes, check consistency + is FirClass<*> -> firClass.superTypeRefs.mapNotNull { firClass.inheritTypeArguments(it, base, arguments) }.firstOrNull() + else -> null } - val baseTypeArguments = - argument.typeRef.coneTypeSafe()?.fullyExpandedType(session)?.typeArguments + } - return if (baseTypeArguments?.isEmpty() != false) { - this - } else { - val typeParameters = (type.lookupTag.toSymbol(session)?.fir as? FirTypeParameterRefsOwner)?.typeParameters.orEmpty() - if (typeParameters.isEmpty()) { - this - } else { - withReplacedConeType( - type.withArguments( - if (baseTypeArguments.size > typeParameters.size) baseTypeArguments.take(typeParameters.size).toTypedArray() - else baseTypeArguments - ) - ) - } + private fun FirTypeParameterRefsOwner.inheritTypeArguments( + typeRef: FirTypeRef, + base: FirClassLikeDeclaration<*>, + arguments: Array + ): Array? { + val type = typeRef.coneTypeSafe() ?: return null + val indexMapping = typeParameters.map { parameter -> + // TODO: if many, check consistency of the result + type.typeArguments.indexOfFirst { it is ConeTypeParameterType && it.lookupTag.typeParameterSymbol == parameter.symbol } } + if (indexMapping.any { it == -1 }) return null + + val typeArguments = type.inheritTypeArguments(base, arguments) ?: return null + return Array(typeParameters.size) { typeArguments[indexMapping[it]] } + } + + private fun FirTypeRef.withTypeArgumentsForBareType(argument: FirExpression): FirTypeRef { + val type = coneTypeSafe() ?: return this + if (type.typeArguments.isNotEmpty()) return this + + val firClass = type.lookupTag.toSymbol(session)?.fir ?: return this + if (firClass !is FirTypeParameterRefsOwner || firClass.typeParameters.isEmpty()) return this + + val baseType = argument.typeRef.coneTypeSafe()?.fullyExpandedType(session) ?: return this + val baseFirClass = baseType.lookupTag.toSymbol(session)?.fir ?: return this + + val newArguments = type.inheritTypeArguments(baseFirClass, baseType.typeArguments) + ?: return buildErrorTypeRef { + source = this@withTypeArgumentsForBareType.source + diagnostic = ConeWrongNumberOfTypeArgumentsError(firClass.typeParameters.size, firClass.symbol) + } + return if (newArguments.isEmpty()) this else withReplacedConeType(type.withArguments(newArguments)) } override fun transformTypeOperatorCall( diff --git a/compiler/testData/codegen/box/when/inferredTypeParameters.kt b/compiler/testData/codegen/box/when/inferredTypeParameters.kt new file mode 100644 index 00000000000..fec494e1e70 --- /dev/null +++ b/compiler/testData/codegen/box/when/inferredTypeParameters.kt @@ -0,0 +1,19 @@ +sealed class C +class A(val x: T) : C() +class B(val x: U) : C() + +fun bar(x: String): C = B(x) +fun baz(x: Any) = "fail: $x" +fun baz(x: String) = x + +typealias Z = B + +fun box(): String = + when (val x = bar("O")) { + is A -> "fail??" + is B -> baz(x.x) + } + when (val y = bar("K")) { + is A -> "fail??" + is Z -> baz(y.x) + else -> "..." + } diff --git a/compiler/testData/diagnostics/tests/cast/bare/AsNullableNotEnough.fir.kt b/compiler/testData/diagnostics/tests/cast/bare/AsNullableNotEnough.fir.kt index 1b46e9c5cdc..b3c7ce638eb 100644 --- a/compiler/testData/diagnostics/tests/cast/bare/AsNullableNotEnough.fir.kt +++ b/compiler/testData/diagnostics/tests/cast/bare/AsNullableNotEnough.fir.kt @@ -4,7 +4,7 @@ interface Tr interface G fun test(tr: Tr) { - val v = tr as G? + val v = tr as G? // If v is not nullable, there will be a warning on this line: - checkSubtype>(v!!) + checkSubtype>(v!!) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cast/bare/EitherAs.fir.kt b/compiler/testData/diagnostics/tests/cast/bare/EitherAs.fir.kt deleted file mode 100644 index 826e39357e0..00000000000 --- a/compiler/testData/diagnostics/tests/cast/bare/EitherAs.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !CHECK_TYPE - -interface Either -interface Left: Either -interface Right: Either - -class C1(val v1: Int) -class C2(val v2: Int) - -fun _as_left(e: Either): Any { - val v = e as Left - return checkSubtype>(v) -} - -fun _as_right(e: Either): Any { - val v = e as Right - return checkSubtype>(v) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cast/bare/EitherAs.kt b/compiler/testData/diagnostics/tests/cast/bare/EitherAs.kt index d3c22b7fa60..22af4925558 100644 --- a/compiler/testData/diagnostics/tests/cast/bare/EitherAs.kt +++ b/compiler/testData/diagnostics/tests/cast/bare/EitherAs.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE interface Either diff --git a/compiler/testData/diagnostics/tests/cast/bare/EitherIs.fir.kt b/compiler/testData/diagnostics/tests/cast/bare/EitherIs.fir.kt deleted file mode 100644 index 8c93645181b..00000000000 --- a/compiler/testData/diagnostics/tests/cast/bare/EitherIs.fir.kt +++ /dev/null @@ -1,25 +0,0 @@ -// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST -interface Either -interface Left: Either { - val value: A -} -interface Right: Either { - val value: B -} - -class C1(val v1: Int) -class C2(val v2: Int) - -fun _is_l(e: Either): Any { - if (e is Left) { - return e.value.v1 - } - return e -} - -fun _is_r(e: Either): Any { - if (e is Right) { - return e.value.v2 - } - return e -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cast/bare/EitherIs.kt b/compiler/testData/diagnostics/tests/cast/bare/EitherIs.kt index 29725127b34..8102d393d0b 100644 --- a/compiler/testData/diagnostics/tests/cast/bare/EitherIs.kt +++ b/compiler/testData/diagnostics/tests/cast/bare/EitherIs.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST interface Either interface Left: Either { diff --git a/compiler/testData/diagnostics/tests/cast/bare/EitherNotIs.fir.kt b/compiler/testData/diagnostics/tests/cast/bare/EitherNotIs.fir.kt deleted file mode 100644 index 3f83e6c0e18..00000000000 --- a/compiler/testData/diagnostics/tests/cast/bare/EitherNotIs.fir.kt +++ /dev/null @@ -1,25 +0,0 @@ -// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST -interface Either -interface Left: Either { - val value: A -} -interface Right: Either { - val value: B -} - -class C1(val v1: Int) -class C2(val v2: Int) - -fun _is_l(e: Either): Any { - if (e !is Left) { - return e - } - return e.value.v1 -} - -fun _is_r(e: Either): Any { - if (e !is Right) { - return e - } - return e.value.v2 -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cast/bare/EitherNotIs.kt b/compiler/testData/diagnostics/tests/cast/bare/EitherNotIs.kt index a07e46eb9c3..9753a462ea6 100644 --- a/compiler/testData/diagnostics/tests/cast/bare/EitherNotIs.kt +++ b/compiler/testData/diagnostics/tests/cast/bare/EitherNotIs.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST interface Either interface Left: Either { diff --git a/compiler/testData/diagnostics/tests/cast/bare/EitherSafeAs.fir.kt b/compiler/testData/diagnostics/tests/cast/bare/EitherSafeAs.fir.kt deleted file mode 100644 index 8a1a2e70014..00000000000 --- a/compiler/testData/diagnostics/tests/cast/bare/EitherSafeAs.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !CHECK_TYPE - -interface Either -interface Left: Either -interface Right: Either - -class C1(val v1: Int) -class C2(val v2: Int) - -fun _as_left(e: Either): Any? { - val v = e as? Left - return checkSubtype?>(v) -} - -fun _as_right(e: Either): Any? { - val v = e as? Right - return checkSubtype?>(v) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cast/bare/EitherSafeAs.kt b/compiler/testData/diagnostics/tests/cast/bare/EitherSafeAs.kt index ff8660f2698..38421fee7e6 100644 --- a/compiler/testData/diagnostics/tests/cast/bare/EitherSafeAs.kt +++ b/compiler/testData/diagnostics/tests/cast/bare/EitherSafeAs.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE interface Either diff --git a/compiler/testData/diagnostics/tests/cast/bare/EitherWhen.fir.kt b/compiler/testData/diagnostics/tests/cast/bare/EitherWhen.fir.kt deleted file mode 100644 index cc6bbd8915a..00000000000 --- a/compiler/testData/diagnostics/tests/cast/bare/EitherWhen.fir.kt +++ /dev/null @@ -1,19 +0,0 @@ -// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST -interface Either -interface Left: Either { - val value: A -} -interface Right: Either { - val value: B -} - -class C1(val v1: Int) -class C2(val v2: Int) - -fun _when(e: Either): Any { - return when (e) { - is Left -> e.value.v1 - is Right -> e.value.v2 - else -> e - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cast/bare/EitherWhen.kt b/compiler/testData/diagnostics/tests/cast/bare/EitherWhen.kt index ca683c6efda..c83fa5057b3 100644 --- a/compiler/testData/diagnostics/tests/cast/bare/EitherWhen.kt +++ b/compiler/testData/diagnostics/tests/cast/bare/EitherWhen.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST interface Either interface Left: Either { diff --git a/compiler/testData/diagnostics/tests/cast/bare/NullableAsNotEnough.fir.kt b/compiler/testData/diagnostics/tests/cast/bare/NullableAsNotEnough.fir.kt index e1509febc32..f85d147fc34 100644 --- a/compiler/testData/diagnostics/tests/cast/bare/NullableAsNotEnough.fir.kt +++ b/compiler/testData/diagnostics/tests/cast/bare/NullableAsNotEnough.fir.kt @@ -4,6 +4,6 @@ interface Tr interface G fun test(tr: Tr?) { - val v = tr as G - checkSubtype>(v) + val v = tr as G + checkSubtype>(v) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cast/bare/NullableAsNullableNotEnough.fir.kt b/compiler/testData/diagnostics/tests/cast/bare/NullableAsNullableNotEnough.fir.kt index 7fa8d3c395e..d9f5de77af8 100644 --- a/compiler/testData/diagnostics/tests/cast/bare/NullableAsNullableNotEnough.fir.kt +++ b/compiler/testData/diagnostics/tests/cast/bare/NullableAsNullableNotEnough.fir.kt @@ -4,6 +4,6 @@ interface Tr interface G fun test(tr: Tr?) { - val v = tr as G? - checkSubtype>(v!!) + val v = tr as G? + checkSubtype>(v!!) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cast/bare/UnrelatedAs.fir.kt b/compiler/testData/diagnostics/tests/cast/bare/UnrelatedAs.fir.kt index 3c480012ddb..99ae494e82b 100644 --- a/compiler/testData/diagnostics/tests/cast/bare/UnrelatedAs.fir.kt +++ b/compiler/testData/diagnostics/tests/cast/bare/UnrelatedAs.fir.kt @@ -4,6 +4,6 @@ interface Tr interface G fun test(tr: Tr) { - val v = tr as G - checkSubtype>(v) + val v = tr as G + checkSubtype>(v) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cast/bare/UnrelatedIs.fir.kt b/compiler/testData/diagnostics/tests/cast/bare/UnrelatedIs.fir.kt index 31a82acc515..8d2b861fab7 100644 --- a/compiler/testData/diagnostics/tests/cast/bare/UnrelatedIs.fir.kt +++ b/compiler/testData/diagnostics/tests/cast/bare/UnrelatedIs.fir.kt @@ -1,4 +1,4 @@ interface Tr interface G -fun test(tr: Tr) = tr is G \ No newline at end of file +fun test(tr: Tr) = tr is G \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/generics/RawTypeInIsExpression.fir.kt b/compiler/testData/diagnostics/tests/generics/RawTypeInIsExpression.fir.kt index e106601f1e6..dd9049258b6 100644 --- a/compiler/testData/diagnostics/tests/generics/RawTypeInIsExpression.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/RawTypeInIsExpression.fir.kt @@ -2,13 +2,13 @@ package p public fun foo(a: Any) { a is Map - a is Map + a is Map a is Map a is Map<*, *> a is Map<> a is List - a is List + a is List a is Int - (a as Map) is Int + (a as Map) is Int } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/generics/RawTypeInIsPattern.fir.kt b/compiler/testData/diagnostics/tests/generics/RawTypeInIsPattern.fir.kt index f76110a228e..bfca3e37219 100644 --- a/compiler/testData/diagnostics/tests/generics/RawTypeInIsPattern.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/RawTypeInIsPattern.fir.kt @@ -1,12 +1,12 @@ public fun foo(a: Any, b: Map) { when (a) { is Map -> {} - is Map -> {} + is Map -> {} is Map -> {} is Map<*, *> -> {} is Map<> -> {} is List -> {} - is List -> {} + is List -> {} is Int -> {} else -> {} } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/bareTypesComplex.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/bareTypesComplex.fir.kt index 0bb4850fb9f..7eaeb08a95e 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/bareTypesComplex.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/bareTypesComplex.fir.kt @@ -8,7 +8,7 @@ class DerivedOuter : SuperOuter() { fun bare(x: SuperOuter<*>.SuperInner<*>, y: Any?) { if (x is SuperOuter.SuperInner) return - if (y is SuperOuter.SuperInner) { + if (y is SuperOuter.SuperInner) { return } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/innerUncheckedCast.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/innerUncheckedCast.fir.kt index bd5a5ec222e..6b1e7bd1725 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/innerUncheckedCast.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/innerUncheckedCast.fir.kt @@ -12,7 +12,7 @@ class Outer { x.prop.checkType { _() } } - if (y is Inner) return + if (y is Inner) return if (z is Inner) { z.prop.checkType { _() } @@ -26,7 +26,7 @@ class Outer { fun bar(x: InnerBase, y: Any?, z: Outer<*>.InnerBase) { x as Inner - y as Inner + y as Inner z as Inner } } diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasAsBareType.fir.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasAsBareType.fir.kt index 5c58097d79b..b375a2a8c49 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasAsBareType.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasAsBareType.fir.kt @@ -14,8 +14,8 @@ fun testNL1(x: Collection?): Boolean = x is NL fun testNL2(x: Collection?): List? = x as NL fun testNL3(x: Collection?): List? = x as NL? -fun testLStar(x: Collection): List = x as LStar -fun testMyList(x: Collection): List = x as MyList +fun testLStar(x: Collection): List = x as LStar +fun testMyList(x: Collection): List = x as MyList typealias MMTT = MutableMap typealias Dictionary = MutableMap @@ -24,8 +24,8 @@ typealias ReadableList = MutableList fun testWrong1(x: Map) = x is MMTT fun testWrong2(x: Map) = x is Dictionary -fun testWrong3(x: Map) = x is WriteableMap -fun testWrong4(x: List) = x is ReadableList +fun testWrong3(x: Map) = x is WriteableMap +fun testWrong4(x: List) = x is ReadableList fun testLocal(x: Any) { class C 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 bb729d71633..160aeb4416c 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 @@ -37312,6 +37312,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt"); } + @Test + @TestMetadata("inferredTypeParameters.kt") + public void testInferredTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt"); + } + @Test @TestMetadata("integralWhenWithNoInlinedConstants.kt") public void testIntegralWhenWithNoInlinedConstants() throws Exception { 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 22a5574719e..021080dbbd3 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 @@ -37112,6 +37112,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt"); } + @Test + @TestMetadata("inferredTypeParameters.kt") + public void testInferredTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt"); + } + @Test @TestMetadata("integralWhenWithNoInlinedConstants.kt") public void testIntegralWhenWithNoInlinedConstants() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index a6bad3af3a6..40c0c116ed4 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -30617,6 +30617,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt"); } + @TestMetadata("inferredTypeParameters.kt") + public void testInferredTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt"); + } + @TestMetadata("integralWhenWithNoInlinedConstants.kt") public void testIntegralWhenWithNoInlinedConstants() throws Exception { runTest("compiler/testData/codegen/box/when/integralWhenWithNoInlinedConstants.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 a878893ba18..18325dc6390 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 @@ -26438,6 +26438,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt"); } + @TestMetadata("inferredTypeParameters.kt") + public void testInferredTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt"); + } + @TestMetadata("integralWhenWithNoInlinedConstants.kt") public void testIntegralWhenWithNoInlinedConstants() throws Exception { runTest("compiler/testData/codegen/box/when/integralWhenWithNoInlinedConstants.kt"); 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 7dfd2fabe16..572014b9ef3 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 @@ -26438,6 +26438,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt"); } + @TestMetadata("inferredTypeParameters.kt") + public void testInferredTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt"); + } + @TestMetadata("integralWhenWithNoInlinedConstants.kt") public void testIntegralWhenWithNoInlinedConstants() throws Exception { runTest("compiler/testData/codegen/box/when/integralWhenWithNoInlinedConstants.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index f3fd0c1d277..dc44e0a72dc 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -26403,6 +26403,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt"); } + @TestMetadata("inferredTypeParameters.kt") + public void testInferredTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt"); + } + @TestMetadata("integralWhenWithNoInlinedConstants.kt") public void testIntegralWhenWithNoInlinedConstants() throws Exception { runTest("compiler/testData/codegen/box/when/integralWhenWithNoInlinedConstants.kt"); 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 13221bc458a..90ae451e0a9 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 @@ -14599,6 +14599,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt"); } + @TestMetadata("inferredTypeParameters.kt") + public void testInferredTypeParameters() throws Exception { + runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt"); + } + @TestMetadata("kt2457.kt") public void testKt2457() throws Exception { runTest("compiler/testData/codegen/box/when/kt2457.kt");