Updated test data and stdlib sources.
This commit is contained in:
@@ -38,7 +38,9 @@ class D() {
|
||||
|
||||
fun foo(): Unit {}
|
||||
|
||||
fun cannotBe(var <!UNUSED_PARAMETER!>i<!>: Int) {
|
||||
fun cannotBe() {
|
||||
var <!UNUSED_VARIABLE!>i<!>: Int = 5
|
||||
|
||||
<!UNRESOLVED_REFERENCE!>z<!> = 30;
|
||||
<!VARIABLE_EXPECTED!>""<!> = "";
|
||||
<!VARIABLE_EXPECTED!>foo()<!> = Unit.VALUE;
|
||||
@@ -49,7 +51,8 @@ fun cannotBe(var <!UNUSED_PARAMETER!>i<!>: Int) {
|
||||
<!VARIABLE_EXPECTED!>5<!> = 34
|
||||
}
|
||||
|
||||
fun canBe(var i: Int, val j: Int) {
|
||||
fun canBe(i0: Int, j: Int) {
|
||||
var <!ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE!>i<!> = i0
|
||||
(i: Int) = <!UNUSED_VALUE!>36<!>
|
||||
(@label i) = <!UNUSED_VALUE!>34<!>
|
||||
|
||||
@@ -60,7 +63,7 @@ fun canBe(var i: Int, val j: Int) {
|
||||
(@ a.a) = 3894
|
||||
}
|
||||
|
||||
fun canBe2(val j: Int) {
|
||||
fun canBe2(j: Int) {
|
||||
(@label <!VAL_REASSIGNMENT!>j<!>) = <!UNUSED_VALUE!>34<!>
|
||||
}
|
||||
|
||||
|
||||
@@ -56,12 +56,13 @@ abstract class Sum() : Iteratee<Int, Int>() {
|
||||
}
|
||||
|
||||
abstract class Collection<E> : Iterable<E> {
|
||||
fun iterate<O>(var iteratee : Iteratee<E, O>) : O {
|
||||
fun iterate<O>(iteratee : Iteratee<E, O>) : O {
|
||||
var current = iteratee
|
||||
for (x in this) {
|
||||
val it = iteratee.process(x)
|
||||
val it = current.process(x)
|
||||
if (it.isDone) return it.result
|
||||
iteratee = it
|
||||
current = it
|
||||
}
|
||||
return iteratee.done()
|
||||
return current.done()
|
||||
}
|
||||
}
|
||||
@@ -53,10 +53,8 @@ fun t2() {
|
||||
|
||||
class A() {}
|
||||
|
||||
fun t4(a: A, val b: A, var c: A) {
|
||||
fun t4(a: A) {
|
||||
<!VAL_REASSIGNMENT!>a<!> = <!UNUSED_VALUE!>A()<!>
|
||||
<!VAL_REASSIGNMENT!>b<!> = <!UNUSED_VALUE!>A()<!>
|
||||
c = <!UNUSED_VALUE!>A()<!>
|
||||
}
|
||||
|
||||
// ------------------------------------------------
|
||||
@@ -190,7 +188,7 @@ class AnonymousInitializers(var a: String, val b: String) {
|
||||
}
|
||||
}
|
||||
|
||||
fun reassignFunParams(val a: Int) {
|
||||
fun reassignFunParams(a: Int) {
|
||||
<!VAL_REASSIGNMENT!>a<!> = <!UNUSED_VALUE!>1<!>
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
package kt1219
|
||||
|
||||
fun <T, R> Iterable<T>.fold(var r: R, op: (T, R) -> R) : R {
|
||||
fun <T, R> Iterable<T>.fold(a: R, op: (T, R) -> R) : R {
|
||||
var r = a
|
||||
this.foreach { r = op(it, r) } //unused value here
|
||||
return r
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
package kt609
|
||||
|
||||
fun test(var a: Int) {
|
||||
a = <!UNUSED_VALUE!>324<!> //should be an 'unused value' warning here
|
||||
fun test(a: Int) {
|
||||
var <!ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE!>aa<!> = a
|
||||
aa = <!UNUSED_VALUE!>324<!> //should be an 'unused value' warning here
|
||||
}
|
||||
|
||||
class C() {
|
||||
@@ -16,4 +17,4 @@ open class A() {
|
||||
|
||||
class B() : A() {
|
||||
final override fun foo(s : String) {} //should not be a warning
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,15 @@ trait B : A {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
fun bar1(a: A, var b: B) {
|
||||
b = a as B
|
||||
fun bar1(a: A) {
|
||||
var b: B = a as B
|
||||
a.foo()
|
||||
b.foo()
|
||||
}
|
||||
|
||||
fun id(b: B) = b
|
||||
fun bar2(a: A, var b: B) {
|
||||
b = id(a as B)
|
||||
fun bar2(a: A) {
|
||||
var b: B = id(a as B)
|
||||
a.foo()
|
||||
b.foo()
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
fun bar1(x: Number, var y: Int) {
|
||||
y += x as Int
|
||||
fun bar1(x: Number, y: Int) {
|
||||
var yy = y
|
||||
yy += x as Int
|
||||
x : Int
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
fun simpleDoWhile(x: Int?, var y: Int) {
|
||||
fun simpleDoWhile(x: Int?, y0: Int) {
|
||||
var y = y0
|
||||
do {
|
||||
x : Int?
|
||||
y++
|
||||
@@ -6,7 +7,8 @@ fun simpleDoWhile(x: Int?, var y: Int) {
|
||||
x : Int
|
||||
}
|
||||
|
||||
fun doWhileWithBreak(x: Int?, var y: Int) {
|
||||
fun doWhileWithBreak(x: Int?, y0: Int) {
|
||||
var y = y0
|
||||
do {
|
||||
x : Int?
|
||||
y++
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
fun simpleWhile(x: Int?, var y: Int) {
|
||||
fun simpleWhile(x: Int?, y0: Int) {
|
||||
var y = y0
|
||||
while (x!! == y) {
|
||||
x : Int
|
||||
y++
|
||||
@@ -6,7 +7,8 @@ fun simpleWhile(x: Int?, var y: Int) {
|
||||
x : Int
|
||||
}
|
||||
|
||||
fun whileWithBreak(x: Int?, var y: Int) {
|
||||
fun whileWithBreak(x: Int?, y0: Int) {
|
||||
var y = y0
|
||||
while (x!! == y) {
|
||||
x : Int
|
||||
break
|
||||
|
||||
@@ -15,7 +15,7 @@ fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
fun bar(val i: Int, val a: <!UNRESOLVED_REFERENCE!>U<!>) {
|
||||
fun bar(i: Int, a: <!UNRESOLVED_REFERENCE!>U<!>) {
|
||||
val r = if (true) i else <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>a<!>
|
||||
val <!UNUSED_VARIABLE!>b<!>: Any = <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>r<!>
|
||||
}
|
||||
|
||||
@@ -11,11 +11,11 @@ public fun <T> MutableCollection<out T>.filterToMy(result : MutableList<in T>, f
|
||||
return this
|
||||
}
|
||||
|
||||
fun foo(result: MutableList<in String>, val collection: MutableCollection<String>, prefix : String){
|
||||
fun foo(result: MutableList<in String>, collection: MutableCollection<String>, prefix : String){
|
||||
collection.filterToMy(result, {it.startsWith(prefix)})
|
||||
}
|
||||
|
||||
fun test(result: MutableList<in Any>, val collection: MutableCollection<String>, prefix : String){
|
||||
fun test(result: MutableList<in Any>, collection: MutableCollection<String>, prefix : String){
|
||||
val c = collection.filterToMy(result, {it.startsWith(prefix)})
|
||||
c: MutableCollection<out String>
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package j
|
||||
|
||||
fun <T : Any> T?.sure() : T = this!!
|
||||
|
||||
fun testArrays(val ci: List<Int?>, val cii: List<Int?>?) {
|
||||
fun testArrays(ci: List<Int?>, cii: List<Int?>?) {
|
||||
val c1: Array<Int?> = cii.sure().toArray(<!FUNCTION_CALL_EXPECTED!><!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>Array<!><Int?><!>)
|
||||
|
||||
val c2: Array<Int?> = ci.toArray(Array<Int?>(<!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>)<!>)
|
||||
|
||||
@@ -210,7 +210,8 @@ fun f(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
fun foo(var a: Any): Int {
|
||||
fun foo(aa: Any): Int {
|
||||
var a = aa
|
||||
if (a is Int) {
|
||||
return <!AUTOCAST_IMPOSSIBLE!>a<!>
|
||||
}
|
||||
|
||||
@@ -22,6 +22,6 @@ class MyElement
|
||||
|
||||
fun test1(collection: MyCollection) {
|
||||
collection.<!OVERLOAD_RESOLUTION_AMBIGUITY!>iterator()<!>
|
||||
for (val element in <!ITERATOR_AMBIGUITY!>collection<!>) {
|
||||
for (element in <!ITERATOR_AMBIGUITY!>collection<!>) {
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ fun main(args: Array<String>) {
|
||||
val numbers = ArrayList<Int>(4)
|
||||
val rnd = Random();
|
||||
val prompt = StringBuilder()
|
||||
for(val i in 0..3) {
|
||||
for(i in 0..3) {
|
||||
val n = rnd.nextInt(9) + 1
|
||||
numbers.add(n)
|
||||
if (i > 0) prompt.append(" ");
|
||||
|
||||
@@ -9,7 +9,7 @@ abstract class Item(val room: <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Object<!>) {
|
||||
val items: ArrayList<Item> = ArrayList<Item>()
|
||||
|
||||
fun test(room : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Object<!>) {
|
||||
for(val item: Item? in items) {
|
||||
for(item: Item? in items) {
|
||||
if (item?.room === room) {
|
||||
System.out.println("You see " + item?.name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user