Remove runtime usage from unused receiver parameter tests

This commit is contained in:
Nikolay Krasko
2018-05-22 13:57:16 +03:00
parent e7a9614fb5
commit fdc6372776
5 changed files with 16 additions and 32 deletions
@@ -1,16 +1,12 @@
// WITH_RUNTIME
class Test(val str: String) { class Test(val str: String) {
private fun <caret>Test.print() { private fun <caret>Test.print() {
println(str) println(str)
println(this.str) println(this.str)
println(this@print.str) println(this@print.str)
println() println(this)
} }
fun test(test: Test) { fun test(test: Test) {
print()
test.print() test.print()
Test("three").print() Test("three").print()
} }
@@ -19,3 +15,5 @@ class Test(val str: String) {
fun main(args: Array<String>) { fun main(args: Array<String>) {
Test("one").test(Test("two")) Test("one").test(Test("two"))
} }
fun println(a: Any) {}
@@ -1,16 +1,12 @@
// WITH_RUNTIME
class Test(val str: String) { class Test(val str: String) {
private fun <caret>print() { private fun <caret>print() {
println(str) println(str)
println(this.str) println(this.str)
println(this.str) println(this.str)
println() println(this)
} }
fun test(test: Test) { fun test(test: Test) {
print()
test.print() test.print()
Test("three").print() Test("three").print()
} }
@@ -19,3 +15,5 @@ class Test(val str: String) {
fun main(args: Array<String>) { fun main(args: Array<String>) {
Test("one").test(Test("two")) Test("one").test(Test("two"))
} }
fun println(a: Any) {}
@@ -1,23 +1,9 @@
// PROBLEM: none // PROBLEM: none
// WITH_RUNTIME
class Test(val str: String) { class Test(val str: String) {
private fun <caret>Test.print() { private fun <caret>Test.print() {
println(str) println(this@Test.str) // Unused receiver isn't reported because of explicit usage for parent `this`
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>) { fun println(a: Any) {}
Test("one").test(Test("two"))
}
@@ -1,7 +1,4 @@
// WITH_RUNTIME
class Test(private val foo: Int) { class Test(private val foo: Int) {
val <caret>Test.baz: Int val <caret>Test.baz: Int
get() = foo + this.foo + this@baz.foo get() = foo + this.foo + this@baz.foo
@@ -15,3 +12,7 @@ class Test(private val foo: Int) {
fun main(args: Array<String>) { fun main(args: Array<String>) {
Test(1).test(Test(2)) Test(1).test(Test(2))
} }
fun println(a: Any) {
// kotlin.io.println(a)
}
@@ -1,7 +1,4 @@
// WITH_RUNTIME
class Test(private val foo: Int) { class Test(private val foo: Int) {
val <caret>baz: Int val <caret>baz: Int
get() = foo + this.foo + this.foo get() = foo + this.foo + this.foo
@@ -15,3 +12,7 @@ class Test(private val foo: Int) {
fun main(args: Array<String>) { fun main(args: Array<String>) {
Test(1).test(Test(2)) Test(1).test(Test(2))
} }
fun println(a: Any) {
// kotlin.io.println(a)
}