Object to lambda intention is inapplicable when reference to this is used
#KT-10202 In Progress
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Test {
|
||||
fun foo() {
|
||||
bar(object : Runnable {
|
||||
override fun run() {
|
||||
println(this)
|
||||
}
|
||||
})
|
||||
|
||||
// Applicable
|
||||
bar(<caret>object : Runnable {
|
||||
override fun run() {
|
||||
println(this@Test)
|
||||
}
|
||||
})
|
||||
|
||||
// Applicable
|
||||
bar(object : Runnable {
|
||||
override fun run() {
|
||||
bar(object : Runnable {
|
||||
override fun run() {
|
||||
println(this)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun bar(b: Runnable) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Test {
|
||||
fun foo() {
|
||||
bar(object : Runnable {
|
||||
override fun run() {
|
||||
println(this)
|
||||
}
|
||||
})
|
||||
|
||||
// Applicable
|
||||
bar(Runnable { println(this@Test) })
|
||||
|
||||
// Applicable
|
||||
bar(object : Runnable {
|
||||
override fun run() {
|
||||
bar(object : Runnable {
|
||||
override fun run() {
|
||||
println(this)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun bar(b: Runnable) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -150,4 +150,20 @@
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Convert object literal to lambda</problem_class>
|
||||
<description>Convert to lambda</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>ThisReference.kt</file>
|
||||
<line>12</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="ThisReference.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Convert object literal to lambda</problem_class>
|
||||
<description>Convert to lambda</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>ThisReference.kt</file>
|
||||
<line>19</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="ThisReference.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Convert object literal to lambda</problem_class>
|
||||
<description>Convert to lambda</description>
|
||||
</problem>
|
||||
</problems>
|
||||
Reference in New Issue
Block a user