diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/typeParameterUtils.kt b/core/descriptors/src/org/jetbrains/kotlin/descriptors/typeParameterUtils.kt index 30c83702075..bc5d6c920fc 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/typeParameterUtils.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/typeParameterUtils.kt @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.descriptors +import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.types.error.MissingDependencyErrorClass import java.util.* @@ -65,7 +66,7 @@ fun KotlinType.buildPossiblyInnerType(): PossiblyInnerType? { } private fun KotlinType.buildPossiblyInnerType(classDescriptor: ClassDescriptor?, index: Int): PossiblyInnerType? { - if (classDescriptor == null) return null + if (classDescriptor == null || ErrorUtils.isError(classDescriptor)) return null val toIndex = classDescriptor.declaredTypeParameters.size + index val argumentsSubList = arguments.subList(index, toIndex) diff --git a/idea/testData/quickfix/modifiers/kt10409.kt b/idea/testData/quickfix/modifiers/kt10409.kt new file mode 100644 index 00000000000..879599fc765 --- /dev/null +++ b/idea/testData/quickfix/modifiers/kt10409.kt @@ -0,0 +1,14 @@ +// "Make 'IterablePipeline' abstract" "true" +// ERROR: 'pipe' overrides nothing +// ERROR: Type argument expected + +// Actually this test is about getting rid of assertion happenning while creating quick fixes +// See KT-10409 +interface Pipeline { + fun pipe(block: Pipeline) +} + +class IterablePipeline : Pipeline { + override fun pipe(block: Pipeline) { + } +} diff --git a/idea/testData/quickfix/modifiers/kt10409.kt.after b/idea/testData/quickfix/modifiers/kt10409.kt.after new file mode 100644 index 00000000000..50fffbbc0ef --- /dev/null +++ b/idea/testData/quickfix/modifiers/kt10409.kt.after @@ -0,0 +1,14 @@ +// "Make 'IterablePipeline' abstract" "true" +// ERROR: 'pipe' overrides nothing +// ERROR: Type argument expected + +// Actually this test is about getting rid of assertion happenning while creating quick fixes +// See KT-10409 +interface Pipeline { + fun pipe(block: Pipeline) +} + +abstract class IterablePipeline : Pipeline { + override fun pipe(block: Pipeline) { + } +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index 1cfb3c91a73..2b228ca8a91 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -4853,6 +4853,12 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { doTest(fileName); } + @TestMetadata("kt10409.kt") + public void testKt10409() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/modifiers/kt10409.kt"); + doTest(fileName); + } + @TestMetadata("nestedClassNotAllowed.kt") public void testNestedClassNotAllowed() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/modifiers/nestedClassNotAllowed.kt");