No assertion error in getContainingPseudocode #KT-10983 Fixed
Also #EA-72954 Fixed
This commit is contained in:
@@ -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? {
|
||||
|
||||
@@ -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<String>): Collection<String>? {
|
||||
val groupsByLength = collection.groupBy { s -> { s.length } }
|
||||
|
||||
val maximumSizeOfGroup = groupsByLength.values.maxBy { it.size }.
|
||||
return groupsByLength.values.firstOrNull { group -> {group.size == maximumSizeOfGroup} }
|
||||
}
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user