Do not try building light classes for inline classes in dumb mode

Generation of inline classes is quite complicated: we mangle methods,
 add stubs and synthesized methods. So, for simplicity, to avoid
 logic duplication in dummy resolve and in the backend, currently we
 will use only the latter for light classes generation

 #KT-26843 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2018-09-17 01:21:34 +03:00
parent 7d2bc5c0f6
commit 03ea8603ce
8 changed files with 27 additions and 10 deletions
@@ -34,10 +34,10 @@ import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.impl.CompositePackageFragmentProvider
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.frontend.di.configureModule
import org.jetbrains.kotlin.idea.caches.project.getModuleInfo
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
import org.jetbrains.kotlin.idea.caches.lightClasses.IDELightClassConstructionContext.Mode.EXACT
import org.jetbrains.kotlin.idea.caches.lightClasses.IDELightClassConstructionContext.Mode.LIGHT
import org.jetbrains.kotlin.idea.caches.project.getModuleInfo
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
import org.jetbrains.kotlin.idea.compiler.IDELanguageSettingsProvider
import org.jetbrains.kotlin.idea.project.IdeaEnvironment
import org.jetbrains.kotlin.idea.project.ResolveElementCache
@@ -173,6 +173,8 @@ internal object IDELightClassContexts {
}
private fun isDummyResolveApplicable(classOrObject: KtClassOrObject): Boolean {
if (classOrObject.hasModifier(KtTokens.INLINE_KEYWORD)) return false
if (classOrObject.hasLightClassMatchingErrors) return false
if (hasDelegatedSupertypes(classOrObject)) return false
@@ -0,0 +1,3 @@
interface IFace {
fun foo()
}
@@ -0,0 +1,3 @@
inline class InlineClass(val x: Int) : IFace {
override fun foo() {}
}
@@ -0,0 +1,3 @@
interface IFace {
fun foo()
}
@@ -0,0 +1,3 @@
inline class InlineClass(val x: Int) : IFace {
override fun <caret>foo() {}
}
@@ -0,0 +1,5 @@
{
"inspectionClass": "org.jetbrains.kotlin.idea.inspections.UnusedSymbolInspection",
"problem": "none",
"mainFile": "test.kt"
}
@@ -236,16 +236,9 @@ public class TypingIndentationTestBaseGenerated extends AbstractTypingIndentatio
runTest("idea/testData/indentationOnNewline/KT20783.after.kt");
}
@TestMetadata("LambdaInCallWithAllightMultilineParameters.after.kt")
public void testLambdaInCallWithAllightMultilineParameters() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/indentationOnNewline/LambdaInCallWithAllightMultilineParameters.after.kt");
doNewlineTest(fileName);
}
@TestMetadata("ModifierListInUnfinishedDeclaration.after.kt")
public void testModifierListInUnfinishedDeclaration() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/indentationOnNewline/ModifierListInUnfinishedDeclaration.after.kt");
doNewlineTest(fileName);
runTest("idea/testData/indentationOnNewline/ModifierListInUnfinishedDeclaration.after.kt");
}
@TestMetadata("MultideclarationAfterEq.after.kt")
@@ -88,4 +88,9 @@ public class MultiFileLocalInspectionTestGenerated extends AbstractMultiFileLoca
public void testUnusedSymbol_fromKotlinTestClass_FromKotlinTestClass() throws Exception {
runTest("idea/testData/multiFileLocalInspections/unusedSymbol/fromKotlinTestClass/fromKotlinTestClass.test");
}
@TestMetadata("unusedSymbol/inlineClassesImplInterface/inlineClassesImplInterface.test")
public void testUnusedSymbol_inlineClassesImplInterface_InlineClassesImplInterface() throws Exception {
runTest("idea/testData/multiFileLocalInspections/unusedSymbol/inlineClassesImplInterface/inlineClassesImplInterface.test");
}
}