Do not suggest destructuring for invisible properties #KT-18665 Fixed

This commit is contained in:
Mikhail Glukhikh
2017-09-07 19:07:45 +03:00
committed by Mikhail Glukhikh
parent c4ebfe8e84
commit c149c37ac7
6 changed files with 64 additions and 0 deletions
@@ -71,4 +71,12 @@
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Use destructuring declaration</problem_class>
<description>Use destructuring declaration</description>
</problem>
<problem>
<file>visible.kt</file>
<line>7</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/visible.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Use destructuring declaration</problem_class>
<description>Use destructuring declaration</description>
</problem>
</problems>
@@ -0,0 +1,16 @@
// SKIP_ERRORS_BEFORE
// SKIP_ERRORS_AFTER
// IS_APPLICABLE: false
fun foo(s: String) {}
data class Example(private val str: String) {
fun doWithExample(block : (Example) -> Unit) = block(Example("hello"))
}
fun Example.runExample() {
doWithExample { example<caret> ->
foo(example.str)
}
}
@@ -0,0 +1,11 @@
fun foo(s: String) {}
data class Example(private val str: String) {
fun doWithExample(block : (Example) -> Unit) = block(Example("hello"))
fun runExample() {
doWithExample { example<caret> ->
foo(example.str)
}
}
}
@@ -0,0 +1,11 @@
fun foo(s: String) {}
data class Example(private val str: String) {
fun doWithExample(block : (Example) -> Unit) = block(Example("hello"))
fun runExample() {
doWithExample { (str1) ->
foo(str1)
}
}
}