From 904017eaff97b95de6d4fda1a4b7ce5b120f6762 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Mon, 5 Sep 2016 16:04:49 +0300 Subject: [PATCH] Covered case when variable of our type is multi-declaration entry --- .../ExpressionsOfTypeProcessor.kt | 2 +- .../components/callableReferences.log | 8 +++++++ .../componentFunForGenericType1.log | 2 ++ .../componentFunForGenericType2.log | 2 ++ .../conventions/components/dataClass.log | 22 +++++++++++++++++++ .../components/dataClassComponentByRef.log | 3 +++ .../components/dataClassInsideDataClass.log | 10 +++++++++ .../components/extensionComponentFun.log | 6 +++++ .../kotlin/conventions/components/for.log | 5 +++++ .../kotlin/conventions/components/isAndAs.log | 4 ++++ .../components/mayTypeAffectAncestors.log | 2 ++ .../components/memberComponentFun.log | 6 +++++ .../conventions/components/operators.log | 6 +++++ .../components/recursiveDataClass1.log | 6 +++++ .../components/recursiveDataClass2.log | 4 ++++ .../findUsages/kotlin/conventions/plus.0.kt | 5 ++++- .../findUsages/kotlin/conventions/plus.log | 12 ++++++++++ .../kotlin/conventions/plus.results.txt | 1 + 18 files changed, 104 insertions(+), 2 deletions(-) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/ExpressionsOfTypeProcessor.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/ExpressionsOfTypeProcessor.kt index 8c38f53f18d..00d1b3db72e 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/ExpressionsOfTypeProcessor.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/ExpressionsOfTypeProcessor.kt @@ -549,7 +549,7 @@ class ExpressionsOfTypeProcessor( */ private fun processSuspiciousDeclaration(declaration: KtDeclaration) { if (declaration is KtDestructuringDeclaration) { - //TODO: process entries! + declaration.entries.forEach { processSuspiciousDeclaration(it) } } else { if (!isImplicitlyTyped(declaration)) return diff --git a/idea/testData/findUsages/kotlin/conventions/components/callableReferences.log b/idea/testData/findUsages/kotlin/conventions/components/callableReferences.log index e4465907342..e04ed79f9fa 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/callableReferences.log +++ b/idea/testData/findUsages/kotlin/conventions/components/callableReferences.log @@ -1,4 +1,12 @@ Checked type of X.f2() +Checked type of a1 +Checked type of a2 +Checked type of a3 +Checked type of a4 +Checked type of b1 +Checked type of b2 +Checked type of b3 +Checked type of b4 Checked type of constructor Checked type of fun2 Checked type of fun3 diff --git a/idea/testData/findUsages/kotlin/conventions/components/componentFunForGenericType1.log b/idea/testData/findUsages/kotlin/conventions/components/componentFunForGenericType1.log index 3f11937eda1..86156c9aa45 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/componentFunForGenericType1.log +++ b/idea/testData/findUsages/kotlin/conventions/components/componentFunForGenericType1.log @@ -1,4 +1,6 @@ Checked type of f() +Checked type of x +Checked type of y Resolved (x, y) 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 07d10fe8fff..c23845e6668 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/componentFunForGenericType2.log +++ b/idea/testData/findUsages/kotlin/conventions/components/componentFunForGenericType2.log @@ -1,5 +1,7 @@ Checked type of f() Checked type of g() +Checked type of x1 +Checked type of y1 Resolved (x1, y1) 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 d187e2b8330..8ec6f649588 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/dataClass.log +++ b/idea/testData/findUsages/kotlin/conventions/components/dataClass.log @@ -3,6 +3,28 @@ Checked type of g() Checked type of h() Checked type of listOfA() Checked type of listOfA() +Checked type of x +Checked type of x1 +Checked type of x1 +Checked type of x2 +Checked type of x2 +Checked type of x3 +Checked type of x4 +Checked type of x5 +Checked type of y +Checked type of y1 +Checked type of y1 +Checked type of y2 +Checked type of y2 +Checked type of y3 +Checked type of y4 +Checked type of y5 +Checked type of z +Checked type of z1 +Checked type of z2 +Checked type of z3 +Checked type of z4 +Checked type of z5 Resolved (x, y, z) Resolved (x1, y1) Resolved (x1, y1, z1) diff --git a/idea/testData/findUsages/kotlin/conventions/components/dataClassComponentByRef.log b/idea/testData/findUsages/kotlin/conventions/components/dataClassComponentByRef.log index c0237c1818b..50fb5bab4c7 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/dataClassComponentByRef.log +++ b/idea/testData/findUsages/kotlin/conventions/components/dataClassComponentByRef.log @@ -1,4 +1,7 @@ Checked type of a +Checked type of x +Checked type of y +Checked type of z Resolved (x, y, z) 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 4dcd79d0396..7f013a696fb 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/dataClassInsideDataClass.log +++ b/idea/testData/findUsages/kotlin/conventions/components/dataClassInsideDataClass.log @@ -1,3 +1,13 @@ +Checked type of a +Checked type of a1 +Checked type of n +Checked type of n1 +Checked type of x +Checked type of x1 +Checked type of y +Checked type of y1 +Checked type of z +Checked type of z1 Resolved (a, n) Resolved (a1, n1) Resolved (x, y, z) diff --git a/idea/testData/findUsages/kotlin/conventions/components/extensionComponentFun.log b/idea/testData/findUsages/kotlin/conventions/components/extensionComponentFun.log index 1b107656639..78ffc0fecbf 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/extensionComponentFun.log +++ b/idea/testData/findUsages/kotlin/conventions/components/extensionComponentFun.log @@ -1,4 +1,10 @@ Checked type of f() +Checked type of x +Checked type of x1 +Checked type of x2 +Checked type of y +Checked type of y1 +Checked type of y2 Resolved (x, y) Resolved (x1, y1) Resolved (x2, y2) diff --git a/idea/testData/findUsages/kotlin/conventions/components/for.log b/idea/testData/findUsages/kotlin/conventions/components/for.log index 2df6432d820..79743842db3 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/for.log +++ b/idea/testData/findUsages/kotlin/conventions/components/for.log @@ -1,4 +1,9 @@ Checked type of parameter a of FOR +Checked type of x +Checked type of x +Checked type of y +Checked type of y +Checked type of z Resolved (x, y) Resolved (x, y, z) Searched references to A diff --git a/idea/testData/findUsages/kotlin/conventions/components/isAndAs.log b/idea/testData/findUsages/kotlin/conventions/components/isAndAs.log index 123485f4e18..ad462ffb706 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/isAndAs.log +++ b/idea/testData/findUsages/kotlin/conventions/components/isAndAs.log @@ -1,4 +1,8 @@ Checked type of list +Checked type of x +Checked type of x1 +Checked type of y +Checked type of y1 Resolved (x, y) Resolved (x1, y1) Searched references to A diff --git a/idea/testData/findUsages/kotlin/conventions/components/mayTypeAffectAncestors.log b/idea/testData/findUsages/kotlin/conventions/components/mayTypeAffectAncestors.log index 2aa23ac656e..f51c0f1d9fe 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/mayTypeAffectAncestors.log +++ b/idea/testData/findUsages/kotlin/conventions/components/mayTypeAffectAncestors.log @@ -1,3 +1,5 @@ +Checked type of x1 +Checked type of y1 Checked type of y1(a: A) Resolved (x1, y1) Searched references to A diff --git a/idea/testData/findUsages/kotlin/conventions/components/memberComponentFun.log b/idea/testData/findUsages/kotlin/conventions/components/memberComponentFun.log index 05dd23197f0..961875f0a7e 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/memberComponentFun.log +++ b/idea/testData/findUsages/kotlin/conventions/components/memberComponentFun.log @@ -1,6 +1,12 @@ Checked type of f() Checked type of g() Checked type of h() +Checked type of x +Checked type of x1 +Checked type of x2 +Checked type of y +Checked type of y1 +Checked type of y2 Resolved (x, y) Resolved (x1, y1) Resolved (x2, y2) diff --git a/idea/testData/findUsages/kotlin/conventions/components/operators.log b/idea/testData/findUsages/kotlin/conventions/components/operators.log index 86f47f74485..959003a94da 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/operators.log +++ b/idea/testData/findUsages/kotlin/conventions/components/operators.log @@ -1,3 +1,9 @@ +Checked type of x +Checked type of x +Checked type of x +Checked type of y +Checked type of y +Checked type of y Resolved (x, y) Resolved b1 + b2 Searched references to A diff --git a/idea/testData/findUsages/kotlin/conventions/components/recursiveDataClass1.log b/idea/testData/findUsages/kotlin/conventions/components/recursiveDataClass1.log index b2b48e65546..39d8933db13 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/recursiveDataClass1.log +++ b/idea/testData/findUsages/kotlin/conventions/components/recursiveDataClass1.log @@ -1,3 +1,9 @@ +Checked type of a1 +Checked type of a2 +Checked type of a2 +Checked type of n1 +Checked type of n2 +Checked type of n2 Resolved (a1, n1) Resolved (a2, n2) Resolved (a2, n2) diff --git a/idea/testData/findUsages/kotlin/conventions/components/recursiveDataClass2.log b/idea/testData/findUsages/kotlin/conventions/components/recursiveDataClass2.log index e144a44ab7f..2f8c2e1685b 100644 --- a/idea/testData/findUsages/kotlin/conventions/components/recursiveDataClass2.log +++ b/idea/testData/findUsages/kotlin/conventions/components/recursiveDataClass2.log @@ -1,3 +1,7 @@ +Checked type of a1 +Checked type of b +Checked type of n +Checked type of s Resolved (a1, s) Resolved (b, n) Searched references to A diff --git a/idea/testData/findUsages/kotlin/conventions/plus.0.kt b/idea/testData/findUsages/kotlin/conventions/plus.0.kt index c8ced1b27d8..634625d9fef 100644 --- a/idea/testData/findUsages/kotlin/conventions/plus.0.kt +++ b/idea/testData/findUsages/kotlin/conventions/plus.0.kt @@ -6,7 +6,7 @@ class A(val n: Int) { operator fun plus(a: A): A = this + a.n } -fun test() { +fun test(array: Array) { A(0) + A(1) + 2 A(0) plus A(1) plus 2 A(0).plus(A(1).plus(2)) @@ -16,4 +16,7 @@ fun test() { a += A(1) +A(0) + + val (a1, a2) = array + a1 + 1 } diff --git a/idea/testData/findUsages/kotlin/conventions/plus.log b/idea/testData/findUsages/kotlin/conventions/plus.log index abaf89168eb..debea08c340 100644 --- a/idea/testData/findUsages/kotlin/conventions/plus.log +++ b/idea/testData/findUsages/kotlin/conventions/plus.log @@ -1,5 +1,9 @@ Checked type of a Checked type of a +Checked type of a1 +Checked type of a1 +Checked type of a2 +Checked type of a2 Resolved A(0) + A(1) Resolved A(0) + A(1) Resolved A(0) + A(1) + 2 @@ -11,6 +15,8 @@ Resolved a += 1 Resolved a += 1 Resolved a += A(1) Resolved a += A(1) +Resolved a1 + 1 +Resolved a1 + 1 Searched references to A Searched references to A Searched references to A.plus(a: A) in Kotlin files @@ -19,8 +25,14 @@ Searched references to A.plus(m: Int) in Kotlin files Searched references to A.plus(m: Int) in Kotlin files Searched references to a in Kotlin files Searched references to a in Kotlin files +Searched references to a1 in Kotlin files +Searched references to a1 in Kotlin files +Searched references to a2 in Kotlin files +Searched references to a2 in Kotlin files Searched references to parameter a of A.plus(a: A) in Kotlin files Searched references to parameter a of A.plus(a: A) in Kotlin files +Searched references to parameter array of test(array: Array) in Kotlin files +Searched references to parameter array of test(array: Array) in Kotlin files Used plain search of A.plus(a: A) in LocalSearchScope: CLASS:A Used plain search of A.plus(m: Int) in LocalSearchScope: diff --git a/idea/testData/findUsages/kotlin/conventions/plus.results.txt b/idea/testData/findUsages/kotlin/conventions/plus.results.txt index c910488b8ec..cbfe124aa22 100644 --- a/idea/testData/findUsages/kotlin/conventions/plus.results.txt +++ b/idea/testData/findUsages/kotlin/conventions/plus.results.txt @@ -2,4 +2,5 @@ Function call 10 A(0) + A(1) + 2 Function call 11 A(0) plus A(1) plus 2 Function call 12 A(0).plus(A(1).plus(2)) Function call 15 a += 1 +Function call 21 a1 + 1 Function call 6 operator fun plus(a: A): A = this + a.n \ No newline at end of file