diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/pseudocodeUtils.kt b/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/pseudocodeUtils.kt index 4b192b28388..2845f5dcc0e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/pseudocodeUtils.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/pseudocodeUtils.kt @@ -299,7 +299,6 @@ fun KtElement.getContainingPseudocode(context: BindingContext): Pseudocode? { val enclosingPseudocode = PseudocodeUtil.generatePseudocode(enclosingPseudocodeDeclaration, context) return enclosingPseudocode.getPseudocodeByElement(pseudocodeDeclaration) - ?: throw AssertionError("Can't find nested pseudocode for element: ${pseudocodeDeclaration.getElementTextWithContext()}") } fun Pseudocode.getPseudocodeByElement(element: KtElement): Pseudocode? { diff --git a/idea/testData/quickfix/createFromUsage/createFunction/call/kt10983.kt b/idea/testData/quickfix/createFromUsage/createFunction/call/kt10983.kt new file mode 100644 index 00000000000..454ee8a96a1 --- /dev/null +++ b/idea/testData/quickfix/createFromUsage/createFunction/call/kt10983.kt @@ -0,0 +1,15 @@ +// "Create function" "false" +// ERROR: A 'return' expression required in a function with a block body ('{...}') +// ERROR: Cannot infer a type for this parameter. Please specify it explicitly. +// ERROR: Cannot infer a type for this parameter. Please specify it explicitly. +// ERROR: Expression 'return groupsByLength.values.firstOrNull { group -> {group.size == maximumSizeOfGroup} }' cannot be a selector (occur after a dot) +// ERROR: Unresolved reference: groupBy +// ERROR: Unresolved reference: it +// ERROR: Unresolved reference: maximumSizeOfGroup + +fun doSomethingStrangeWithCollection(collection: Collection): Collection? { + val groupsByLength = collection.groupBy { s -> { s.length } } + + val maximumSizeOfGroup = groupsByLength.values.maxBy { it.size }. + return groupsByLength.values.firstOrNull { group -> {group.size == maximumSizeOfGroup} } +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index 4d9235c69ad..b017aa48ba5 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -1988,6 +1988,12 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { doTest(fileName); } + @TestMetadata("kt10983.kt") + public void testKt10983() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createFunction/call/kt10983.kt"); + doTest(fileName); + } + @TestMetadata("localFunNoReceiver.kt") public void testLocalFunNoReceiver() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createFunction/call/localFunNoReceiver.kt");