From 63d4491eb8d13e060e24adae6dd923f2c4c8da57 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Sun, 28 Aug 2016 22:45:09 +0300 Subject: [PATCH] More actions logged in tests --- .../usagesSearch/destructuringDeclarationUsages.kt | 7 +++++++ .../findUsages/kotlin/conventions/components/SAM.log | 1 + .../components/componentFunForGenericType1.log | 2 ++ .../components/componentFunForGenericType2.log | 3 +++ .../kotlin/conventions/components/dataClass.log | 11 +++++++++++ .../components/dataClassComponentByRef.log | 2 ++ .../components/dataClassInsideDataClass.log | 4 ++++ .../conventions/components/extensionComponentFun.log | 2 ++ .../findUsages/kotlin/conventions/components/for.log | 3 +++ .../kotlin/conventions/components/isAndAs.log | 3 +++ .../conventions/components/memberComponentFun.log | 6 ++++++ 11 files changed, 44 insertions(+) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/destructuringDeclarationUsages.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/destructuringDeclarationUsages.kt index b1e3b5bc057..e9891488baf 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/destructuringDeclarationUsages.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/destructuringDeclarationUsages.kt @@ -407,6 +407,8 @@ private class Processor( if (method != null && method.hasModifierProperty(PsiModifier.ABSTRACT)) { val psiClass = method.containingClass if (psiClass != null) { + testLog?.add("Resolved to java class to descriptor: ${psiClass.qualifiedName}") + val classDescriptor = psiClass.resolveToDescriptor(target.getResolutionFacade()) if (classDescriptor != null && SingleAbstractMethodUtils.getSingleAbstractMethodOrNull(classDescriptor) != null) { addSamInterfaceToProcess(psiClass) @@ -491,6 +493,8 @@ private class Processor( private fun processSuspiciousDeclaration(declaration: KtDeclaration) { if (declaration is KtDestructuringDeclaration) { if (searchScope.contains(declaration)) { + testLog?.add("Checked type of ${declaration.logPresentation()}") + val declarationReference = declaration.references.firstIsInstance() if (declarationReference.isReferenceTo(target)) { consumer.process(declarationReference) @@ -500,6 +504,8 @@ private class Processor( else { if (!isImplicitlyTyped(declaration)) return + testLog?.add("Checked type of ${declaration.logPresentation()}") + val descriptor = declaration.resolveToDescriptorIfAny() as? CallableDescriptor ?: return val type = descriptor.returnType if (type != null && type.containsTypeOrDerivedInside(dataType)) { @@ -586,6 +592,7 @@ private class Processor( val owner = this.ownerFunction?.logPresentation() ?: this.parent.toString() "parameter ${this.name} in $owner" } + is KtDestructuringDeclaration -> entries.joinToString(", ", prefix = "(", postfix = ")") { it.text } else -> fqName } } diff --git a/idea/testData/findUsages/kotlin/conventions/components/SAM.log b/idea/testData/findUsages/kotlin/conventions/components/SAM.log index 2bd78a52fb9..49c2acd43c9 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/SAM.log +++ b/idea/testData/findUsages/kotlin/conventions/components/SAM.log @@ -1,3 +1,4 @@ +Resolved to java class to descriptor: JavaSAM Searched inheritors of pack.A Searched references to JavaClass.takeSAM() in Kotlin files Searched references to JavaSAM in java files diff --git a/idea/testData/findUsages/kotlin/conventions/components/componentFunForGenericType1.log b/idea/testData/findUsages/kotlin/conventions/components/componentFunForGenericType1.log index 3a15116da7b..7e402f2ddba 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/componentFunForGenericType1.log +++ b/idea/testData/findUsages/kotlin/conventions/components/componentFunForGenericType1.log @@ -1,3 +1,5 @@ +Checked type of (x, y) +Checked type of f() Searched inheritors of X Searched references to X Searched references to f() in Kotlin files diff --git a/idea/testData/findUsages/kotlin/conventions/components/componentFunForGenericType2.log b/idea/testData/findUsages/kotlin/conventions/components/componentFunForGenericType2.log index cc43ac3947c..f1b5f41801b 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/componentFunForGenericType2.log +++ b/idea/testData/findUsages/kotlin/conventions/components/componentFunForGenericType2.log @@ -1,3 +1,6 @@ +Checked type of (x1, y1) +Checked type of f() +Checked type of g() Searched inheritors of X Searched references to X Searched references to f() in Kotlin files diff --git a/idea/testData/findUsages/kotlin/conventions/components/dataClass.log b/idea/testData/findUsages/kotlin/conventions/components/dataClass.log index f55bf210a63..64d221f9239 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/dataClass.log +++ b/idea/testData/findUsages/kotlin/conventions/components/dataClass.log @@ -1,3 +1,14 @@ +Checked type of (x, y, z) +Checked type of (x1, y1, z1) +Checked type of (x2, y2, z2) +Checked type of (x3, y3, z3) +Checked type of (x4, y4, z4) +Checked type of (x5, y5, z5) +Checked type of a +Checked type of g() +Checked type of h() +Checked type of listOfA() +Checked type of listOfA() Searched inheritors of pack.A Searched references to JavaClass.getA() in Kotlin files Searched references to a in Kotlin files diff --git a/idea/testData/findUsages/kotlin/conventions/components/dataClassComponentByRef.log b/idea/testData/findUsages/kotlin/conventions/components/dataClassComponentByRef.log index b43c5e95f2a..c6108837d72 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/dataClassComponentByRef.log +++ b/idea/testData/findUsages/kotlin/conventions/components/dataClassComponentByRef.log @@ -1,3 +1,5 @@ +Checked type of (x, y, z) +Checked type of a Searched inheritors of A Searched references to A Searched references to a in Kotlin files diff --git a/idea/testData/findUsages/kotlin/conventions/components/dataClassInsideDataClass.log b/idea/testData/findUsages/kotlin/conventions/components/dataClassInsideDataClass.log index d4acf0d6855..23c85e6c727 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/dataClassInsideDataClass.log +++ b/idea/testData/findUsages/kotlin/conventions/components/dataClassInsideDataClass.log @@ -1,3 +1,7 @@ +Checked type of (a, n) +Checked type of (a1, n1) +Checked type of (x, y, z) +Checked type of (x1, y1, z1) Searched inheritors of A Searched inheritors of B Searched inheritors of C diff --git a/idea/testData/findUsages/kotlin/conventions/components/extensionComponentFun.log b/idea/testData/findUsages/kotlin/conventions/components/extensionComponentFun.log index 75dc0acccd6..df510c3b09b 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/extensionComponentFun.log +++ b/idea/testData/findUsages/kotlin/conventions/components/extensionComponentFun.log @@ -1,3 +1,5 @@ +Checked type of (x, y) +Checked type of f() Searched inheritors of X Searched references to X Searched references to Y diff --git a/idea/testData/findUsages/kotlin/conventions/components/for.log b/idea/testData/findUsages/kotlin/conventions/components/for.log index 688bf123c1c..35f82297184 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/for.log +++ b/idea/testData/findUsages/kotlin/conventions/components/for.log @@ -1,3 +1,6 @@ +Checked type of (x, y) +Checked type of (x, y, z) +Checked type of parameter a in FOR Searched inheritors of A Searched references to A Searched references to parameter a in FOR in Kotlin files diff --git a/idea/testData/findUsages/kotlin/conventions/components/isAndAs.log b/idea/testData/findUsages/kotlin/conventions/components/isAndAs.log index 3d96ce4e4db..6a6c4ef4771 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/isAndAs.log +++ b/idea/testData/findUsages/kotlin/conventions/components/isAndAs.log @@ -1,3 +1,6 @@ +Checked type of (x, y) +Checked type of (x1, y1) +Checked type of list Searched inheritors of A Searched references to A Searched references to list in Kotlin files diff --git a/idea/testData/findUsages/kotlin/conventions/components/memberComponentFun.log b/idea/testData/findUsages/kotlin/conventions/components/memberComponentFun.log index 7d11d970bdf..3a1c80b6125 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/memberComponentFun.log +++ b/idea/testData/findUsages/kotlin/conventions/components/memberComponentFun.log @@ -1,3 +1,9 @@ +Checked type of (x, y) +Checked type of (x1, y1) +Checked type of (x2, y2) +Checked type of f() +Checked type of g() +Checked type of h() Searched inheritors of X Searched references to X Searched references to Y