"Unused receiver parameter" inspection: Fix false negative in same class (KT-23897)
#KT-23897 Fixed
This commit is contained in:
committed by
Nikolay Krasko
parent
793d34b913
commit
e7a9614fb5
+21
@@ -0,0 +1,21 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Test(val str: String) {
|
||||
|
||||
private fun <caret>Test.print() {
|
||||
println(str)
|
||||
println(this.str)
|
||||
println(this@print.str)
|
||||
println()
|
||||
}
|
||||
|
||||
fun test(test: Test) {
|
||||
print()
|
||||
test.print()
|
||||
Test("three").print()
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
Test("one").test(Test("two"))
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Test(val str: String) {
|
||||
|
||||
private fun <caret>print() {
|
||||
println(str)
|
||||
println(this.str)
|
||||
println(this.str)
|
||||
println()
|
||||
}
|
||||
|
||||
fun test(test: Test) {
|
||||
print()
|
||||
test.print()
|
||||
Test("three").print()
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
Test("one").test(Test("two"))
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Test(val str: String) {
|
||||
|
||||
private fun <caret>Test.print() {
|
||||
println(str)
|
||||
println(this.str)
|
||||
println(this@print.str)
|
||||
println(this@Test.str)
|
||||
println()
|
||||
}
|
||||
|
||||
fun test(test: Test) {
|
||||
print()
|
||||
test.print()
|
||||
Test("three").print()
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
Test("one").test(Test("two"))
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Test(private val foo: Int) {
|
||||
|
||||
val <caret>Test.baz: Int
|
||||
get() = foo + this.foo + this@baz.foo
|
||||
|
||||
fun test(test: Test) {
|
||||
println(baz)
|
||||
println(test.baz)
|
||||
println(Test(3).baz)
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
Test(1).test(Test(2))
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Test(private val foo: Int) {
|
||||
|
||||
val <caret>baz: Int
|
||||
get() = foo + this.foo + this.foo
|
||||
|
||||
fun test(test: Test) {
|
||||
println(baz)
|
||||
println(test.baz)
|
||||
println(Test(3).baz)
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
Test(1).test(Test(2))
|
||||
}
|
||||
Reference in New Issue
Block a user