diff --git a/plugins/kotlin/formatter/src/org/jetbrains/kotlin/idea/core/formatter/KotlinCodeStyleSettings.java b/plugins/kotlin/formatter/src/org/jetbrains/kotlin/idea/core/formatter/KotlinCodeStyleSettings.java index e067549fb8e3..4f874b3359fd 100644 --- a/plugins/kotlin/formatter/src/org/jetbrains/kotlin/idea/core/formatter/KotlinCodeStyleSettings.java +++ b/plugins/kotlin/formatter/src/org/jetbrains/kotlin/idea/core/formatter/KotlinCodeStyleSettings.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.core.formatter; @@ -35,6 +35,7 @@ public class KotlinCodeStyleSettings extends CustomCodeStyleSettings { public boolean SPACE_AFTER_EXTEND_COLON = true; public boolean INSERT_WHITESPACES_IN_SIMPLE_ONE_LINE_METHOD = true; public boolean ALIGN_IN_COLUMNS_CASE_BRANCH = false; + public boolean LINE_BREAK_AFTER_MULTILINE_WHEN_ENTRY = true; public boolean SPACE_AROUND_FUNCTION_TYPE_ARROW = true; public boolean SPACE_AROUND_WHEN_ARROW = true; public boolean SPACE_BEFORE_LAMBDA_ARROW = true; diff --git a/plugins/kotlin/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt b/plugins/kotlin/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt index d5e49d8ff973..36abe65b2e3a 100644 --- a/plugins/kotlin/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt +++ b/plugins/kotlin/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt @@ -529,14 +529,31 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing inPosition(right = CLASS_BODY).customRule(leftBraceRule(blockType = CLASS_BODY)) inPosition(left = WHEN_ENTRY, right = WHEN_ENTRY).customRule { _, left, right -> - val leftEntry = left.requireNode().psi as KtWhenEntry - val rightEntry = right.requireNode().psi as KtWhenEntry - val blankLines = if (leftEntry.expression is KtBlockExpression || rightEntry.expression is KtBlockExpression) - kotlinCustomSettings.BLANK_LINES_AROUND_BLOCK_WHEN_BRANCHES - else - 0 + val blankLines = kotlinCustomSettings.BLANK_LINES_AROUND_BLOCK_WHEN_BRANCHES + if (blankLines != 0) { + val leftEntry = left.requireNode().psi as KtWhenEntry + val rightEntry = right.requireNode().psi as KtWhenEntry + if (leftEntry.expression is KtBlockExpression || rightEntry.expression is KtBlockExpression) { + return@customRule createSpacing(0, minLineFeeds = blankLines + 1) + } + } - createSpacing(0, minLineFeeds = blankLines + 1) + if (kotlinCustomSettings.LINE_BREAK_AFTER_MULTILINE_WHEN_ENTRY) { + builderUtil.createLineFeedDependentSpacing( + minSpaces = 0, + maxSpaces = 0, + minimumLineFeeds = 1, + keepLineBreaks = commonCodeStyleSettings.KEEP_LINE_BREAKS, + keepBlankLines = commonCodeStyleSettings.KEEP_BLANK_LINES_IN_CODE, + dependency = left.textRange, + rule = DependentSpacingRule(DependentSpacingRule.Trigger.HAS_LINE_FEEDS).registerData( + DependentSpacingRule.Anchor.MIN_LINE_FEEDS, + 2, + ), + ) + } else { + createSpacing(0, minLineFeeds = 1) + } } inPosition(parent = WHEN_ENTRY, right = BLOCK).customRule(leftBraceRule()) diff --git a/plugins/kotlin/frontend-independent/resources-en/messages/KotlinBundle.properties b/plugins/kotlin/frontend-independent/resources-en/messages/KotlinBundle.properties index 5a88db586d44..c2795f19a1bd 100644 --- a/plugins/kotlin/frontend-independent/resources-en/messages/KotlinBundle.properties +++ b/plugins/kotlin/frontend-independent/resources-en/messages/KotlinBundle.properties @@ -520,6 +520,7 @@ formatter.text.use.defaults.from=Use defaults from: formatter.title.after.colon.before.declaration.type=After colon, before declaration type formatter.title.after.colon.in.new.type.definition=After colon in new type definition formatter.title.align.when.branches.in.columns=Align 'when' branches in columns +formatter.title.line.break.after.multiline.when.entry=New line after multiline entry formatter.title.around.arrow.in.function.types=Around arrow in function types formatter.title.around.arrow.in=Around arrow in "when" clause formatter.title.around.when.branches.with=Around 'when' branches with {} diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinLanguageCodeStyleSettingsProvider.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinLanguageCodeStyleSettingsProvider.kt index db1e44f5d338..3d49c9555d15 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinLanguageCodeStyleSettingsProvider.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/formatter/KotlinLanguageCodeStyleSettingsProvider.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.formatter @@ -195,6 +195,12 @@ class KotlinLanguageCodeStyleSettingsProvider : LanguageCodeStyleSettingsProvide codeStyleSettingsCustomizableOptions.WRAPPING_SWITCH_STATEMENT ) + showCustomOption( + KotlinCodeStyleSettings::LINE_BREAK_AFTER_MULTILINE_WHEN_ENTRY, + KotlinBundle.message("formatter.title.line.break.after.multiline.when.entry"), + codeStyleSettingsCustomizableOptions.WRAPPING_SWITCH_STATEMENT + ) + showCustomOption( KotlinCodeStyleSettings::LBRACE_ON_NEXT_LINE, KotlinBundle.message("formatter.title.put.left.brace.on.new.line"), diff --git a/plugins/kotlin/idea/tests/testData/codeStyle/obsoleteCodeStyle.json b/plugins/kotlin/idea/tests/testData/codeStyle/obsoleteCodeStyle.json index 6dac10611b6d..6d870ad1f8cc 100644 --- a/plugins/kotlin/idea/tests/testData/codeStyle/obsoleteCodeStyle.json +++ b/plugins/kotlin/idea/tests/testData/codeStyle/obsoleteCodeStyle.json @@ -55,6 +55,7 @@ "keep_indents_on_empty_lines": false, "keep_line_breaks": true, "lbrace_on_next_line": false, + "line_break_after_multiline_when_entry": true, "line_comment_add_space": false, "line_comment_add_space_on_reformat": false, "line_comment_at_first_column": true, diff --git a/plugins/kotlin/idea/tests/testData/codeStyle/officialCodeStyle.json b/plugins/kotlin/idea/tests/testData/codeStyle/officialCodeStyle.json index 2769ecaa6b81..0b61ee1f6ef1 100644 --- a/plugins/kotlin/idea/tests/testData/codeStyle/officialCodeStyle.json +++ b/plugins/kotlin/idea/tests/testData/codeStyle/officialCodeStyle.json @@ -55,6 +55,7 @@ "keep_indents_on_empty_lines": false, "keep_line_breaks": true, "lbrace_on_next_line": false, + "line_break_after_multiline_when_entry": true, "line_comment_add_space": false, "line_comment_add_space_on_reformat": false, "line_comment_at_first_column": true, diff --git a/plugins/kotlin/idea/tests/testData/formatter/When.after.inv.kt b/plugins/kotlin/idea/tests/testData/formatter/When.after.inv.kt index 519157c88463..d92fdb33f4cb 100644 --- a/plugins/kotlin/idea/tests/testData/formatter/When.after.inv.kt +++ b/plugins/kotlin/idea/tests/testData/formatter/When.after.inv.kt @@ -45,3 +45,4 @@ val a = when { } // SET_FALSE: ALIGN_IN_COLUMNS_CASE_BRANCH +// SET_TRUE: LINE_BREAK_AFTER_MULTILINE_WHEN_ENTRY diff --git a/plugins/kotlin/idea/tests/testData/formatter/When.after.kt b/plugins/kotlin/idea/tests/testData/formatter/When.after.kt index 76710a871fbc..aef812b51146 100644 --- a/plugins/kotlin/idea/tests/testData/formatter/When.after.kt +++ b/plugins/kotlin/idea/tests/testData/formatter/When.after.kt @@ -40,8 +40,10 @@ fun some(x: Any) { val a = when { true && true && true -> { } + else -> { } } // SET_FALSE: ALIGN_IN_COLUMNS_CASE_BRANCH +// SET_TRUE: LINE_BREAK_AFTER_MULTILINE_WHEN_ENTRY diff --git a/plugins/kotlin/idea/tests/testData/formatter/When.kt b/plugins/kotlin/idea/tests/testData/formatter/When.kt index 6f41fba2db2a..93b3665154de 100644 --- a/plugins/kotlin/idea/tests/testData/formatter/When.kt +++ b/plugins/kotlin/idea/tests/testData/formatter/When.kt @@ -50,4 +50,5 @@ val a = when { } } -// SET_FALSE: ALIGN_IN_COLUMNS_CASE_BRANCH \ No newline at end of file +// SET_FALSE: ALIGN_IN_COLUMNS_CASE_BRANCH +// SET_TRUE: LINE_BREAK_AFTER_MULTILINE_WHEN_ENTRY \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/formatter/WhenEntry.after.inv.kt b/plugins/kotlin/idea/tests/testData/formatter/WhenEntry.after.inv.kt index 588a4d80bf4d..39248fe25882 100644 --- a/plugins/kotlin/idea/tests/testData/formatter/WhenEntry.after.inv.kt +++ b/plugins/kotlin/idea/tests/testData/formatter/WhenEntry.after.inv.kt @@ -3,6 +3,7 @@ fun a() { true && true -> {} false -> { } + else -> {} } } diff --git a/plugins/kotlin/idea/tests/testData/formatter/WhenEntry.after.kt b/plugins/kotlin/idea/tests/testData/formatter/WhenEntry.after.kt index 67b59a4c7a06..c554cc0ecc3e 100644 --- a/plugins/kotlin/idea/tests/testData/formatter/WhenEntry.after.kt +++ b/plugins/kotlin/idea/tests/testData/formatter/WhenEntry.after.kt @@ -3,6 +3,7 @@ fun a() { true && true -> {} false -> { } + else -> {} } } diff --git a/plugins/kotlin/idea/tests/testData/formatter/WhenEntryExpr.after.kt b/plugins/kotlin/idea/tests/testData/formatter/WhenEntryExpr.after.kt index deab5bf7c721..150e26eacbeb 100644 --- a/plugins/kotlin/idea/tests/testData/formatter/WhenEntryExpr.after.kt +++ b/plugins/kotlin/idea/tests/testData/formatter/WhenEntryExpr.after.kt @@ -2,10 +2,13 @@ fun some(x: Any) { when (x) { is Int -> 0 + 3 -> 2 + in 0..3 -> 2 + else -> 1 } @@ -13,12 +16,15 @@ fun some(x: Any) { is Int -> { 0 } + 3 -> { 2 } + in 0..3 -> { 2 } + else -> { 1 } @@ -27,12 +33,15 @@ fun some(x: Any) { is Int -> { 0 } + 3 -> { 2 } + in 0..3 -> { 2 } + else -> { 1 } @@ -43,19 +52,22 @@ fun some(x: Any) { -> { 0 } + 3, -> { 2 } + in 0..3, -> { 2 } + else -> { 1 } } } -// SET_TRUE: ALLOW_TRAILING_COMMA \ No newline at end of file +// SET_TRUE: ALLOW_TRAILING_COMMA diff --git a/plugins/kotlin/idea/tests/testData/formatter/WhenLineBreak.after.inv.kt b/plugins/kotlin/idea/tests/testData/formatter/WhenLineBreak.after.inv.kt index 1a41f7a98acb..c411daa6fbce 100644 --- a/plugins/kotlin/idea/tests/testData/formatter/WhenLineBreak.after.inv.kt +++ b/plugins/kotlin/idea/tests/testData/formatter/WhenLineBreak.after.inv.kt @@ -2,6 +2,7 @@ fun f() { when (c) { a -> { } + b -> j else -> { } @@ -10,6 +11,7 @@ fun f() { when (c) { a -> { } + b -> j else -> { } @@ -18,6 +20,7 @@ fun f() { when (c) { a -> { } + b -> j else -> { } @@ -28,6 +31,7 @@ fun f() { a -> //eol comment { } + b -> j else -> //eol comment { diff --git a/plugins/kotlin/idea/tests/testData/formatter/WhenLineBreak.after.kt b/plugins/kotlin/idea/tests/testData/formatter/WhenLineBreak.after.kt index 4cde661cccb7..9d84a08255d3 100644 --- a/plugins/kotlin/idea/tests/testData/formatter/WhenLineBreak.after.kt +++ b/plugins/kotlin/idea/tests/testData/formatter/WhenLineBreak.after.kt @@ -5,6 +5,7 @@ fun f() a -> { } + b -> j else -> { @@ -16,6 +17,7 @@ fun f() a -> { } + b -> j else -> { @@ -27,6 +29,7 @@ fun f() a -> { } + b -> j else -> { @@ -38,6 +41,7 @@ fun f() a -> //eol comment { } + b -> j else -> //eol comment { diff --git a/plugins/kotlin/idea/tests/testData/formatter/callChain/KT22071.after.kt b/plugins/kotlin/idea/tests/testData/formatter/callChain/KT22071.after.kt index 6ea342a33695..1f5030b36773 100644 --- a/plugins/kotlin/idea/tests/testData/formatter/callChain/KT22071.after.kt +++ b/plugins/kotlin/idea/tests/testData/formatter/callChain/KT22071.after.kt @@ -19,9 +19,11 @@ abstract class TemplateGroupBase : TemplateGroup { when { it.returnType.isSubtypeOf(typeMemberTemplate) -> yield(it.call(this) as MemberTemplate) + it.returnType.isSubtypeOf(typeIterableOfMemberTemplates) -> @Suppress("UNCHECKED_CAST") yieldAll(it.call(this) as Iterable) + else -> error("Member $it violates naming convention") } diff --git a/plugins/kotlin/idea/tests/testData/formatter/trailingComma/whenEntry/WhenEntry.after.inv.kt b/plugins/kotlin/idea/tests/testData/formatter/trailingComma/whenEntry/WhenEntry.after.inv.kt index ba25bd1d7cd0..5b4f5e22f52e 100644 --- a/plugins/kotlin/idea/tests/testData/formatter/trailingComma/whenEntry/WhenEntry.after.inv.kt +++ b/plugins/kotlin/idea/tests/testData/formatter/trailingComma/whenEntry/WhenEntry.after.inv.kt @@ -1,6 +1,7 @@ fun foo(x: Any) = when (x) { Comparable::class, Iterable::class, String::class, // trailing comma -> println(1) + else -> println(3) } @@ -13,6 +14,7 @@ fun foo(x: Any) { when (x) { Comparable::class, Iterable::class, String::class /*// trailing comma*/ -> println(1) + else -> println(3) } @@ -20,6 +22,7 @@ fun foo(x: Any) { Comparable::class, Iterable::class, String::class, /*// trailing comma*/ -> println(1) + else -> println(3) } @@ -32,6 +35,7 @@ fun foo(x: Any) { 1 -> { } + else -> println(3) } @@ -39,6 +43,7 @@ fun foo(x: Any) { 1 -> { } + else -> println(3) } @@ -47,6 +52,7 @@ fun foo(x: Any) { -> { } + else -> println(3) } @@ -55,6 +61,7 @@ fun foo(x: Any) { 3 /**/ -> { } + else -> println(3) } @@ -63,6 +70,7 @@ fun foo(x: Any) { 3 /**/ -> { } + else -> println(3) } @@ -71,8 +79,9 @@ fun foo(x: Any) { -> { } + else -> println(3) } } -// SET_TRUE: ALLOW_TRAILING_COMMA \ No newline at end of file +// SET_TRUE: ALLOW_TRAILING_COMMA diff --git a/plugins/kotlin/idea/tests/testData/formatter/trailingComma/whenEntry/WhenEntry.after.kt b/plugins/kotlin/idea/tests/testData/formatter/trailingComma/whenEntry/WhenEntry.after.kt index 74781ae6bfe2..cc9d73f73e8b 100644 --- a/plugins/kotlin/idea/tests/testData/formatter/trailingComma/whenEntry/WhenEntry.after.kt +++ b/plugins/kotlin/idea/tests/testData/formatter/trailingComma/whenEntry/WhenEntry.after.kt @@ -1,6 +1,7 @@ fun foo(x: Any) = when (x) { Comparable::class, Iterable::class, String::class, // trailing comma -> println(1) + else -> println(3) } @@ -14,6 +15,7 @@ fun foo(x: Any) { Comparable::class, Iterable::class, String::class, /*// trailing comma*/ -> println(1) + else -> println(3) } @@ -21,6 +23,7 @@ fun foo(x: Any) { Comparable::class, Iterable::class, String::class, /*// trailing comma*/ -> println(1) + else -> println(3) } @@ -33,6 +36,7 @@ fun foo(x: Any) { 1 -> { } + else -> println(3) } @@ -40,6 +44,7 @@ fun foo(x: Any) { 1 -> { } + else -> println(3) } @@ -48,6 +53,7 @@ fun foo(x: Any) { -> { } + else -> println(3) } @@ -57,6 +63,7 @@ fun foo(x: Any) { -> { } + else -> println(3) } @@ -66,6 +73,7 @@ fun foo(x: Any) { -> { } + else -> println(3) } @@ -74,8 +82,9 @@ fun foo(x: Any) { -> { } + else -> println(3) } } -// SET_TRUE: ALLOW_TRAILING_COMMA \ No newline at end of file +// SET_TRUE: ALLOW_TRAILING_COMMA diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/cascadeIf/withAnnotation.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/cascadeIf/withAnnotation.kt.after index cb1626e17718..f8c84baade55 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/cascadeIf/withAnnotation.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/cascadeIf/withAnnotation.kt.after @@ -7,9 +7,10 @@ fun foo(a: Any) { is String -> { println(a) } + is List<*> -> { @Suppress("UNCHECKED_CAST") println(a as List) } } -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/coroutines/deferredIsResult/complex.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/coroutines/deferredIsResult/complex.kt.after index 703cc1856b48..83cad8dc5335 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/coroutines/deferredIsResult/complex.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/coroutines/deferredIsResult/complex.kt.after @@ -11,6 +11,7 @@ suspend fun myFunction(context: CoroutineContext, switch: Int): Int { val x = 123 x * x } + 1 -> return withContext(context) { -1 } else -> return withContext(Dispatchers.Default) { 9 } } diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/liftOut/whenToAssignment/innerWhenTransformed.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/liftOut/whenToAssignment/innerWhenTransformed.kt.after index e3f66801cc99..98ca95707bd1 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/liftOut/whenToAssignment/innerWhenTransformed.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/liftOut/whenToAssignment/innerWhenTransformed.kt.after @@ -9,6 +9,7 @@ fun test(n: Int): String { doSomething("***") "one" } + else -> { doSomething("***") "two" diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/simplifyWhenWithBooleanConstantCondition/trueIsNotTop2.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/simplifyWhenWithBooleanConstantCondition/trueIsNotTop2.kt.after index 53092f1d43b4..6854e9eb81db 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/simplifyWhenWithBooleanConstantCondition/trueIsNotTop2.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/simplifyWhenWithBooleanConstantCondition/trueIsNotTop2.kt.after @@ -5,9 +5,10 @@ fun test(i: Int) { println(1) 1 } + else -> { println(3) 3 } } -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/simplifyWhenWithBooleanConstantCondition/trueIsNotTop3.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/simplifyWhenWithBooleanConstantCondition/trueIsNotTop3.kt.after index ebec7678e1b6..c78d12f80cbf 100644 --- a/plugins/kotlin/idea/tests/testData/inspectionsLocal/simplifyWhenWithBooleanConstantCondition/trueIsNotTop3.kt.after +++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/simplifyWhenWithBooleanConstantCondition/trueIsNotTop3.kt.after @@ -4,8 +4,9 @@ fun test(i: Int) { i == 1 -> { println(1) } + else -> { println(3) } } -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/intentions/addBraces/addBracesForElseWithCommentInsideWhen.kt.after b/plugins/kotlin/idea/tests/testData/intentions/addBraces/addBracesForElseWithCommentInsideWhen.kt.after index 964a948d29b3..d1ee4a4ffb08 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/addBraces/addBracesForElseWithCommentInsideWhen.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/addBraces/addBracesForElseWithCommentInsideWhen.kt.after @@ -5,7 +5,8 @@ fun test(x: Int, b: Boolean) { if (b) 1 else { 2 // comment } + else -> 0 } -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/intentions/branched/ifWhen/ifToWhen/ifElseSwallowTail.kt.after b/plugins/kotlin/idea/tests/testData/intentions/branched/ifWhen/ifToWhen/ifElseSwallowTail.kt.after index b7527a5dd28b..b3d87ee95f05 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/branched/ifWhen/ifToWhen/ifElseSwallowTail.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/branched/ifWhen/ifToWhen/ifElseSwallowTail.kt.after @@ -3,6 +3,7 @@ fun toInt(s: Number): Int { is Int -> { foo() } + else -> { return -1 } diff --git a/plugins/kotlin/idea/tests/testData/intentions/branched/ifWhen/ifToWhen/withInternalLoop.kt.after b/plugins/kotlin/idea/tests/testData/intentions/branched/ifWhen/ifToWhen/withInternalLoop.kt.after index ae44ba399697..56780962ca74 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/branched/ifWhen/ifToWhen/withInternalLoop.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/branched/ifWhen/ifToWhen/withInternalLoop.kt.after @@ -8,12 +8,14 @@ fun testIf(xs: List) { continue // do not change } } + is Int -> { break } + else -> { println(x) } } } -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/intentions/branched/ifWhen/ifToWhen/withInternalLoopOnly.kt.after b/plugins/kotlin/idea/tests/testData/intentions/branched/ifWhen/ifToWhen/withInternalLoopOnly.kt.after index f36329b5e1b1..9eab3df86640 100644 --- a/plugins/kotlin/idea/tests/testData/intentions/branched/ifWhen/ifToWhen/withInternalLoopOnly.kt.after +++ b/plugins/kotlin/idea/tests/testData/intentions/branched/ifWhen/ifToWhen/withInternalLoopOnly.kt.after @@ -9,8 +9,9 @@ fun testIf(x: Any) { break // do not change } } + else -> { println(x) } } -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/default/ignoredReturnValueWithWhen.kt.after b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/default/ignoredReturnValueWithWhen.kt.after index a3dcc43e90eb..479cb42779d0 100644 --- a/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/default/ignoredReturnValueWithWhen.kt.after +++ b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/default/ignoredReturnValueWithWhen.kt.after @@ -20,6 +20,7 @@ private fun __dummyTestFun__(a: Int, b: Int) { a > 0 -> { bar(a) } + else -> { b } diff --git a/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/pairWithWhen.kt.after b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/pairWithWhen.kt.after index 7b86384a2c0d..cd8322d6a219 100644 --- a/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/pairWithWhen.kt.after +++ b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/pairWithWhen.kt.after @@ -25,6 +25,7 @@ private fun pair(a: Int, b: Int, c: Int): Pair { a > 0 -> { b1 += a } + else -> { c1 -= a } @@ -32,4 +33,4 @@ private fun pair(a: Int, b: Int, c: Int): Pair { println(b1) println(c1) return Pair(b1, c1) -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/singleOutputValueWithWhen.kt.after b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/singleOutputValueWithWhen.kt.after index 4c2306181c1c..9c60a6cdad1d 100644 --- a/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/singleOutputValueWithWhen.kt.after +++ b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/singleOutputValueWithWhen.kt.after @@ -17,10 +17,11 @@ private fun i(a: Int, b: Int): Int { a > 0 -> { b1 = b1 + 1 } + a < 0 -> { b1 = b1 - 1 } } println(b1) return b1 -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/singleOutputValueWithWhenElse.kt.after b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/singleOutputValueWithWhenElse.kt.after index 2e48adfc37f5..48e563e64e5a 100644 --- a/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/singleOutputValueWithWhenElse.kt.after +++ b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/controlFlow/outputValues/singleOutputValueWithWhenElse.kt.after @@ -17,13 +17,15 @@ private fun i(a: Int, b: Int): Int { a > 0 -> { b1 = b1 + 1 } + a < 0 -> { b1 = b1 - 1 } + else -> { b1 = a } } println(b1) return b1 -} \ No newline at end of file +} diff --git a/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/parameters/candidateTypes/multipleTypes2.kt.after b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/parameters/candidateTypes/multipleTypes2.kt.after index f2ec9237c123..aef267de43c4 100644 --- a/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/parameters/candidateTypes/multipleTypes2.kt.after +++ b/plugins/kotlin/idea/tests/testData/refactoring/extractFunction/parameters/candidateTypes/multipleTypes2.kt.after @@ -22,5 +22,6 @@ private fun i(o: Any) = when (o) { is A -> { if (o is T) o.a + o.t else o.a } + else -> o.hashCode() -} \ No newline at end of file +} diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/issues/kt-22848.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/issues/kt-22848.kt index 9f8360444e65..47653d7a51ae 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/issues/kt-22848.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/issues/kt-22848.kt @@ -11,6 +11,7 @@ object Test { b = 1 a = b } + else -> { b = -1 a = b diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/KT-13552.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/KT-13552.kt index bd7f4b6406fd..5026610ce526 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/KT-13552.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/KT-13552.kt @@ -10,6 +10,7 @@ object SwitchDemo { print(5) 5 } + 2 -> { print(2) print(3) @@ -17,21 +18,25 @@ object SwitchDemo { print(5) 5 } + 3 -> { print(3) print(4) print(5) 5 } + 4 -> { print(4) print(5) 5 } + 5 -> { print(5) 5 } + 6 -> { print(6) print(7) @@ -42,6 +47,7 @@ object SwitchDemo { monthString = "December" 13 } + 7 -> { print(7) print(8) @@ -51,6 +57,7 @@ object SwitchDemo { monthString = "December" 13 } + 8 -> { print(8) print(9) @@ -59,6 +66,7 @@ object SwitchDemo { monthString = "December" 13 } + 9 -> { print(9) print(10) @@ -66,21 +74,25 @@ object SwitchDemo { monthString = "December" 13 } + 10 -> { print(10) print(11) monthString = "December" 13 } + 11 -> { print(11) monthString = "December" 13 } + 12 -> { monthString = "December" 13 } + else -> { print(4) print(5) diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/caseWithBlock.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/caseWithBlock.kt index 280955a9b400..c21eb57fcc11 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/caseWithBlock.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/caseWithBlock.kt @@ -5,11 +5,13 @@ fun foo(a: Int): Int { println(x) 1 } + 2 -> { val x = 2 println(x) 2 } + 3 -> { println(3) } diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/comlicatedFallDown.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/comlicatedFallDown.kt index d10459074bb8..b344d5310a12 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/comlicatedFallDown.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/comlicatedFallDown.kt @@ -16,6 +16,7 @@ object SwitchDemo { print(5) 5 } + 2 -> { print(2) print(3) @@ -23,21 +24,25 @@ object SwitchDemo { print(5) 5 } + 3 -> { print(3) print(4) print(5) 5 } + 4 -> { print(4) print(5) 5 } + 5 -> { print(5) 5 } + 6 -> { print(6) print(7) @@ -48,6 +53,7 @@ object SwitchDemo { monthString = "December" 12 } + 7 -> { print(7) print(8) @@ -57,6 +63,7 @@ object SwitchDemo { monthString = "December" 12 } + 8 -> { print(8) print(9) @@ -65,6 +72,7 @@ object SwitchDemo { monthString = "December" 12 } + 9 -> { print(9) print(10) @@ -72,21 +80,25 @@ object SwitchDemo { monthString = "December" 12 } + 10 -> { print(10) print(11) monthString = "December" 12 } + 11 -> { print(11) monthString = "December" 12 } + 12 -> { monthString = "December" 12 } + else -> { monthString = "Invalid month" 13 diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/continueAndBreakWithLabel.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/continueAndBreakWithLabel.kt index d76b77776951..c54fbb861a76 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/continueAndBreakWithLabel.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/continueAndBreakWithLabel.kt @@ -6,8 +6,9 @@ fun foo() { println("2") return } + 3 -> break@Loop } println() } -} \ No newline at end of file +} diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/fallDownWithBlocks.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/fallDownWithBlocks.kt index 12ba36df2058..17f8cdbe2fe0 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/fallDownWithBlocks.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/fallDownWithBlocks.kt @@ -15,6 +15,7 @@ object C { print("2") } } + 2 -> { val a = 2 print("2") diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/kt-539.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/kt-539.kt index e77c84d550dc..c8e81200bc06 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/kt-539.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/kt-539.kt @@ -10,50 +10,62 @@ object SwitchDemo { monthString = "January" 1 } + 2 -> { monthString = "February" 2 } + 3 -> { monthString = "March" 3 } + 4 -> { monthString = "April" 4 } + 5 -> { monthString = "May" 5 } + 6 -> { monthString = "June" 6 } + 7 -> { monthString = "July" 7 } + 8 -> { monthString = "August" 8 } + 9 -> { monthString = "September" 9 } + 10 -> { monthString = "October" 10 } + 11 -> { monthString = "November" 11 } + 12 -> { monthString = "December" 12 } + else -> { monthString = "Invalid month" 13 diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedIf.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedIf.kt index cd6bc0ed14ee..52d8e4688e95 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedIf.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedIf.kt @@ -5,6 +5,7 @@ fun foo(i: Int, j: Int) { } else { "2" } + 1 -> "3" else -> "4" } diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedIfFallback.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedIfFallback.kt index b2251b774b93..14aa02608496 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedIfFallback.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedIfFallback.kt @@ -5,6 +5,7 @@ fun foo(i: Int, j: Int): String { "1" } else "2" } + 1 -> "2" else -> "3" } diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedSwitch.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedSwitch.kt index 69eeae0c6218..4cc178244ddc 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedSwitch.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedSwitch.kt @@ -4,6 +4,7 @@ fun foo(i: Int, j: Int) { 1 -> "0, 1" else -> "0, x" } + 1 -> "1, x" else -> "x, x" } diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedSwitchFallback.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedSwitchFallback.kt index 5983b2344301..9d8f0768525a 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedSwitchFallback.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nestedSwitchFallback.kt @@ -7,6 +7,7 @@ fun foo(i: Int, j: Int) { } "1, x" } + 1 -> "1, x" else -> "x, x" } diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nondefault.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nondefault.kt index 89c1f31f8157..8cfc45bd8f4d 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nondefault.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/nondefault.kt @@ -9,10 +9,12 @@ object NonDefault { valueString = "ONE" 1 } + 2 -> { valueString = "TWO" 2 } + 3 -> { valueString = "THREE" 3 diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/returnsAndThrows.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/returnsAndThrows.kt index 1768dcb409d2..36b7b764a708 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/returnsAndThrows.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/newJavaFeatures/switchExpression/returnsAndThrows.kt @@ -4,14 +4,17 @@ fun foo(a: Int): Int { println("1") 1 } + 2 -> { println("2") 2 } + 3 -> { println("3") throw RuntimeException() } + else -> { println("default") 0 diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/KT-13552.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/KT-13552.kt index 027154107c67..215508b1694b 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/KT-13552.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/KT-13552.kt @@ -9,21 +9,25 @@ object SwitchDemo { print(4) print(5) } + 2 -> { print(2) print(3) print(4) print(5) } + 3 -> { print(3) print(4) print(5) } + 4 -> { print(4) print(5) } + 5 -> print(5) 6 -> { print(6) @@ -34,6 +38,7 @@ object SwitchDemo { print(11) monthString = "December" } + 7 -> { print(7) print(8) @@ -42,6 +47,7 @@ object SwitchDemo { print(11) monthString = "December" } + 8 -> { print(8) print(9) @@ -49,21 +55,25 @@ object SwitchDemo { print(11) monthString = "December" } + 9 -> { print(9) print(10) print(11) monthString = "December" } + 10 -> { print(10) print(11) monthString = "December" } + 11 -> { print(11) monthString = "December" } + 12 -> monthString = "December" else -> { print(4) @@ -79,4 +89,4 @@ object SwitchDemo { else -> -0x9a0000 } } -} \ No newline at end of file +} diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/caseWithBlock.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/caseWithBlock.kt index a35895dcd161..eab51c98e059 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/caseWithBlock.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/caseWithBlock.kt @@ -4,12 +4,14 @@ fun foo() { val x = 1 println(x) } + 2 -> { val x = 2 println(x) } + 3 -> { println(3) } } -} \ No newline at end of file +} diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/comlicatedFallDown.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/comlicatedFallDown.kt index 1218c75d72ef..aafa8232196d 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/comlicatedFallDown.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/comlicatedFallDown.kt @@ -15,21 +15,25 @@ object SwitchDemo { print(4) print(5) } + 2 -> { print(2) print(3) print(4) print(5) } + 3 -> { print(3) print(4) print(5) } + 4 -> { print(4) print(5) } + 5 -> print(5) 6 -> { print(6) @@ -40,6 +44,7 @@ object SwitchDemo { print(11) monthString = "December" } + 7 -> { print(7) print(8) @@ -48,6 +53,7 @@ object SwitchDemo { print(11) monthString = "December" } + 8 -> { print(8) print(9) @@ -55,21 +61,25 @@ object SwitchDemo { print(11) monthString = "December" } + 9 -> { print(9) print(10) print(11) monthString = "December" } + 10 -> { print(10) print(11) monthString = "December" } + 11 -> { print(11) monthString = "December" } + 12 -> monthString = "December" else -> monthString = "Invalid month" } @@ -80,4 +90,4 @@ object SwitchDemo { fun main(args: Array) { for (i in 1..12) test(i) } -} \ No newline at end of file +} diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/continueAndBreakWithLabel.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/continueAndBreakWithLabel.kt index d76b77776951..c54fbb861a76 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/continueAndBreakWithLabel.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/continueAndBreakWithLabel.kt @@ -6,8 +6,9 @@ fun foo() { println("2") return } + 3 -> break@Loop } println() } -} \ No newline at end of file +} diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/fallDownWithBlocks.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/fallDownWithBlocks.kt index 78c183227ff0..f63deadd53fc 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/fallDownWithBlocks.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/fallDownWithBlocks.kt @@ -12,10 +12,11 @@ object C { print("2") } } + 2 -> { val a = 2 print("2") } } } -} \ No newline at end of file +} diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedIf.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedIf.kt index d9ae9b0a658e..2546942ef98f 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedIf.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedIf.kt @@ -5,7 +5,8 @@ fun foo(i: Int, j: Int): String { } else { "2" } + 1 -> "3" else -> "4" } -} \ No newline at end of file +} diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedIfFallback.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedIfFallback.kt index 2f15300c4937..691b429c61c8 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedIfFallback.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedIfFallback.kt @@ -5,7 +5,8 @@ fun foo(i: Int, j: Int): String { "1" } else "2" } + 1 -> "2" else -> "3" } -} \ No newline at end of file +} diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedSwitch.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedSwitch.kt index 33d91f394f90..c00cfb4afcfb 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedSwitch.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedSwitch.kt @@ -4,7 +4,8 @@ fun foo(i: Int, j: Int): String { 1 -> "0, 1" else -> "0, x" } + 1 -> "1, x" else -> "x, x" } -} \ No newline at end of file +} diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedSwitchFallback.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedSwitchFallback.kt index eec644f9c9dc..83c20f9cbf60 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedSwitchFallback.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/nestedSwitchFallback.kt @@ -7,7 +7,8 @@ fun foo(i: Int, j: Int): String { } "1, x" } + 1 -> "1, x" else -> "x, x" } -} \ No newline at end of file +} diff --git a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/returnsAndThrows.kt b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/returnsAndThrows.kt index bbcba69002e3..a510789e1a06 100644 --- a/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/returnsAndThrows.kt +++ b/plugins/kotlin/j2k/new/tests/testData/newJ2k/switch/returnsAndThrows.kt @@ -4,17 +4,20 @@ fun foo(a: Int): Int { println("1") 1 } + 2 -> { println("2") 2 } + 3 -> { println("3") throw RuntimeException() } + else -> { println("default") 0 } } -} \ No newline at end of file +}