diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index 96cfd7db7ff..eb3152fa44c 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -5071,11 +5071,11 @@ The "returned" value of try expression with no finally is either the last expres private StackValue generateWhenCondition(KtExpression subjectExpression, Type subjectType, KotlinType subjectKotlinType, int subjectLocal, KtWhenCondition condition) { if (condition instanceof KtWhenConditionInRange) { KtWhenConditionInRange conditionInRange = (KtWhenConditionInRange) condition; - return generateIn(StackValue.local(subjectLocal, subjectType), + return generateIn(StackValue.local(subjectLocal, subjectType, subjectKotlinType), conditionInRange.getRangeExpression(), conditionInRange.getOperationReference()); } - StackValue.Local match = subjectLocal == -1 ? null : StackValue.local(subjectLocal, subjectType); + StackValue.Local match = subjectLocal == -1 ? null : StackValue.local(subjectLocal, subjectType, subjectKotlinType); if (condition instanceof KtWhenConditionIsPattern) { KtWhenConditionIsPattern patternCondition = (KtWhenConditionIsPattern) condition; return generateIsCheck(match, patternCondition.getTypeReference(), patternCondition.isNegated()); diff --git a/compiler/testData/codegen/box/ranges/unsigned/kt35004.kt b/compiler/testData/codegen/box/ranges/unsigned/kt35004.kt new file mode 100644 index 00000000000..b25193a7db0 --- /dev/null +++ b/compiler/testData/codegen/box/ranges/unsigned/kt35004.kt @@ -0,0 +1,11 @@ +// IGNORE_BACKEND_FIR: JVM_IR +// WITH_RUNTIME +// KJS_WITH_FULL_RUNTIME + +fun ULong.foobar() = + when (this) { + in 0U..1U -> "OK" + else -> throw AssertionError("$this") + } + +fun box(): String = 0UL.foobar() \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 4e302ba7a26..5a6e14b7693 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -21998,6 +21998,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/ranges/unsigned/inMixedUnsignedRange.kt"); } + @TestMetadata("kt35004.kt") + public void testKt35004() throws Exception { + runTest("compiler/testData/codegen/box/ranges/unsigned/kt35004.kt"); + } + @TestMetadata("compiler/testData/codegen/box/ranges/unsigned/expression") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 9e56e52ca59..52ab9258a17 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -20815,6 +20815,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/ranges/unsigned/inMixedUnsignedRange.kt"); } + @TestMetadata("kt35004.kt") + public void testKt35004() throws Exception { + runTest("compiler/testData/codegen/box/ranges/unsigned/kt35004.kt"); + } + @TestMetadata("compiler/testData/codegen/box/ranges/unsigned/expression") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index c6deaf255a0..675ecc0e9fa 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -20533,6 +20533,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/ranges/unsigned/inMixedUnsignedRange.kt"); } + @TestMetadata("kt35004.kt") + public void testKt35004() throws Exception { + runTest("compiler/testData/codegen/box/ranges/unsigned/kt35004.kt"); + } + @TestMetadata("compiler/testData/codegen/box/ranges/unsigned/expression") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 8fb1a5f2222..c29d2f820a7 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -20533,6 +20533,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/ranges/unsigned/inMixedUnsignedRange.kt"); } + @TestMetadata("kt35004.kt") + public void testKt35004() throws Exception { + runTest("compiler/testData/codegen/box/ranges/unsigned/kt35004.kt"); + } + @TestMetadata("compiler/testData/codegen/box/ranges/unsigned/expression") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 00cd0d0db6e..acb49ff849c 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -17683,6 +17683,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/ranges/unsigned/inMixedUnsignedRange.kt"); } + @TestMetadata("kt35004.kt") + public void testKt35004() throws Exception { + runTest("compiler/testData/codegen/box/ranges/unsigned/kt35004.kt"); + } + @TestMetadata("compiler/testData/codegen/box/ranges/unsigned/expression") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 13a9463a26b..32841151a3c 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -18813,6 +18813,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/ranges/unsigned/inMixedUnsignedRange.kt"); } + @TestMetadata("kt35004.kt") + public void testKt35004() throws Exception { + runTest("compiler/testData/codegen/box/ranges/unsigned/kt35004.kt"); + } + @TestMetadata("compiler/testData/codegen/box/ranges/unsigned/expression") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)