Add more "Safe Delete" tests for value parameters

This commit is contained in:
Alexey Sedunov
2014-01-24 14:50:42 +04:00
parent 5f69317f1e
commit 624ac55415
24 changed files with 221 additions and 0 deletions
@@ -0,0 +1,13 @@
package test;
class A {
void bar() {
TestPackage.foo(
10, new Function1<Integer, Unit>() {
public Unit invoke(Integer n) {
System.out.println(n);
}
}
);
}
}
@@ -0,0 +1,9 @@
package test;
class A {
void bar() {
TestPackage.foo(
10
);
}
}
@@ -0,0 +1,9 @@
package test
fun foo(n: Int, <caret>f: (Int) -> Unit) {
println(n)
}
fun bar() {
foo(10) { n -> println(n) }
}
@@ -0,0 +1,9 @@
package test
fun foo(n: Int) {
println(n)
}
fun bar() {
foo(10)
}
@@ -0,0 +1,13 @@
package test;
class A {
void bar() {
TestPackage.foo(
"", 10, new Function1<Integer, Unit>() {
public Unit invoke(Integer n) {
System.out.println(n);
}
}
);
}
}
@@ -0,0 +1,9 @@
package test;
class A {
void bar() {
TestPackage.foo(
"", 10
);
}
}
@@ -0,0 +1,9 @@
package test
fun String.foo(n: Int, <caret>f: (Int) -> Unit) {
println(n)
}
fun bar() {
"".foo(10) { n -> println(n) }
}
@@ -0,0 +1,9 @@
package test
fun String.foo(n: Int) {
println(n)
}
fun bar() {
"".foo(10)
}
@@ -0,0 +1,7 @@
package test;
class B {
void bar() {
System.out.println(new A("").getName());
}
}
@@ -0,0 +1,7 @@
package test
class A(val <caret>name: String)
fun bar() {
println(A("").name)
}
@@ -0,0 +1 @@
method A.getName() has 2 usages that are not safe to delete.
@@ -0,0 +1,7 @@
package test;
class B {
void bar() {
System.out.println(new A(""));
}
}
@@ -0,0 +1,7 @@
package test;
class B {
void bar() {
System.out.println(new A());
}
}
@@ -0,0 +1,7 @@
package test
class A(val <caret>name: String)
fun bar() {
println(A(""))
}
@@ -0,0 +1,7 @@
package test
class A()
fun bar() {
println(A())
}