"Unused value" error added to existed tests
This commit is contained in:
@@ -161,6 +161,6 @@ abstract class B3(i: Int) {
|
||||
}
|
||||
|
||||
fun foo(a: B3) {
|
||||
val a = <error>B3()</error>
|
||||
val b = <error>B1(2, "s")</error>
|
||||
val <warning>a</warning> = <error>B3()</error>
|
||||
val <warning>b</warning> = <error>B1(2, "s")</error>
|
||||
}
|
||||
@@ -28,7 +28,7 @@ class WithC() {
|
||||
}
|
||||
|
||||
this(a : Int) : this() {
|
||||
val b = x
|
||||
val <warning>b</warning> = x
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,7 +28,7 @@ fun A.plus(a : Int) {
|
||||
fun <T> T.minus(t : T) : Int = 1
|
||||
|
||||
fun test() {
|
||||
val y = 1.abs
|
||||
val <warning>y</warning> = 1.abs
|
||||
}
|
||||
val Int.abs : Int
|
||||
get() = if (this > 0) this else -this;
|
||||
|
||||
@@ -9,10 +9,10 @@ fun testIncDec() {
|
||||
++x
|
||||
x--
|
||||
--x
|
||||
x = x++
|
||||
x = x--
|
||||
x = <warning>x++</warning>
|
||||
x = <warning>x--</warning>
|
||||
x = ++x
|
||||
x = --x
|
||||
x = <warning>--x</warning>
|
||||
}
|
||||
|
||||
class WrongIncDec() {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
namespace qualified_expressions
|
||||
|
||||
fun test(s: String?) {
|
||||
val a: Int = <error>s?.length</error>
|
||||
val <warning>a</warning>: Int = <error>s?.length</error>
|
||||
val b: Int? = s?.length
|
||||
val c: Int = s?.length ?: -11
|
||||
val d: Int = s?.length ?: <error>"empty"</error>
|
||||
val <warning>c</warning>: Int = s?.length ?: -11
|
||||
val <warning>d</warning>: Int = s?.length ?: <error>"empty"</error>
|
||||
val e: String = <error>s?.length</error> ?: "empty"
|
||||
val f: Int = s?.length ?: b ?: 1
|
||||
val g: Int? = e? startsWith("s")?.length
|
||||
val <warning>f</warning>: Int = s?.length ?: b ?: 1
|
||||
val <warning>g</warning>: Int? = e? startsWith("s")?.length
|
||||
}
|
||||
@@ -31,9 +31,9 @@ namespace closures {
|
||||
val Int.xx = this : Int
|
||||
fun Char.xx() : Any {
|
||||
this : Char
|
||||
val a = {Double.() => this : Double + this@xx : Char}
|
||||
val b = @a{Double.() => this@a : Double + this@xx : Char}
|
||||
val c = @a{() => <error>this@a</error> + this@xx : Char}
|
||||
val <warning>a</warning> = {Double.() => this : Double + this@xx : Char}
|
||||
val <warning>b</warning> = @a{Double.() => this@a : Double + this@xx : Char}
|
||||
val <warning>c</warning> = @a{() => <error>this@a</error> + this@xx : Char}
|
||||
return (@a{Double.() => this@a : Double + this@xx : Char})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@ import java.lang.Comparable as Com
|
||||
val l : List<in Int> = ArrayList<Int>()
|
||||
|
||||
fun test(l : java.util.List<Int>) {
|
||||
val x : java.<error>List</error>
|
||||
val y : java.util.List<Int>
|
||||
val b : java.lang.Object
|
||||
val a : util.List<Int>
|
||||
val z : java.<error>utils</error>.List<Int>
|
||||
val <warning>x</warning> : java.<error>List</error>
|
||||
val <warning>y</warning> : java.util.List<Int>
|
||||
val <warning>b</warning> : java.lang.Object
|
||||
val <warning>a</warning> : util.List<Int>
|
||||
val <warning>z</warning> : java.<error>utils</error>.List<Int>
|
||||
|
||||
val f : java.io.File? = null
|
||||
val <warning>f</warning> : java.io.File? = null
|
||||
|
||||
Collections.<error>emptyList</error>
|
||||
Collections.emptyList<Int>
|
||||
@@ -27,7 +27,7 @@ fun test(l : java.util.List<Int>) {
|
||||
<error>List</error><Int>
|
||||
|
||||
|
||||
val o = "sdf" <warning>as</warning> Object
|
||||
val <warning>o</warning> = "sdf" <warning>as</warning> Object
|
||||
|
||||
try {
|
||||
// ...
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
namespace unresolved
|
||||
|
||||
fun testGenericArgumentsCount() {
|
||||
val p1: Tuple2<error><Int></error> = (2, 2)
|
||||
val p2: <error>Tuple2</error> = (2, 2)
|
||||
val <warning>p1</warning>: Tuple2<error><Int></error> = (2, 2)
|
||||
val <warning>p2</warning>: <error>Tuple2</error> = (2, 2)
|
||||
}
|
||||
|
||||
fun testUnresolved() {
|
||||
if (<error>a</error> is String) {
|
||||
val s = <error>a</error>
|
||||
val <warning>s</warning> = <error>a</error>
|
||||
}
|
||||
<error>foo</error>(<error>a</error>)
|
||||
val s = "s"
|
||||
|
||||
@@ -8,13 +8,13 @@ abstract class Usual<T> {}
|
||||
|
||||
fun foo(c: Consumer<Int>, p: Producer<Int>, u: Usual<Int>) {
|
||||
val c1: Consumer<Any> = <error>c</error>
|
||||
val c2: Consumer<Int> = c1
|
||||
val <warning>c2</warning>: Consumer<Int> = c1
|
||||
|
||||
val p1: Producer<Any> = p
|
||||
val p2: Producer<Int> = <error>p1</error>
|
||||
val <warning>p2</warning>: Producer<Int> = <error>p1</error>
|
||||
|
||||
val u1: Usual<Any> = <error>u</error>
|
||||
val u2: Usual<Int> = <error>u1</error>
|
||||
val <warning>u2</warning>: Usual<Int> = <error>u1</error>
|
||||
}
|
||||
|
||||
//Arrays copy example
|
||||
|
||||
@@ -163,42 +163,42 @@ fun illegalWhenBlock(a: Any): Int {
|
||||
}
|
||||
fun declarations(a: Any?) {
|
||||
if (a is String) {
|
||||
val p4: (Int, String) = (2, <info descr="Automatically cast to String">a</info>)
|
||||
val <warning>p4</warning>: (Int, String) = (2, <info descr="Automatically cast to String">a</info>)
|
||||
}
|
||||
if (a is String?) {
|
||||
if (a != null) {
|
||||
val s: String = <info descr="Automatically cast to String">a</info>
|
||||
val <warning>s</warning>: String = <info descr="Automatically cast to String">a</info>
|
||||
}
|
||||
}
|
||||
if (a != null) {
|
||||
if (a is String?) {
|
||||
val s: String = <info descr="Automatically cast to String">a</info>
|
||||
val <warning>s</warning>: String = <info descr="Automatically cast to String">a</info>
|
||||
}
|
||||
}
|
||||
}
|
||||
fun vars(a: Any?) {
|
||||
var b: Int = 0
|
||||
var <warning>b</warning>: Int = 0
|
||||
if (a is Int) {
|
||||
b = <info descr="Automatically cast to Int">a</info>
|
||||
b = <info descr="Automatically cast to Int"><warning>a</warning></info>
|
||||
}
|
||||
}
|
||||
fun tuples(a: Any?) {
|
||||
if (a != null) {
|
||||
val s: (Any, String) = (<info descr="Automatically cast to Any">a</info>, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but String was expected">a</error>)
|
||||
val <warning>s</warning>: (Any, String) = (<info descr="Automatically cast to Any">a</info>, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but String was expected">a</error>)
|
||||
}
|
||||
if (a is String) {
|
||||
val s: (Any, String) = (<info descr="Automatically cast to Any">a</info>, <info descr="Automatically cast to String">a</info>)
|
||||
val <warning>s</warning>: (Any, String) = (<info descr="Automatically cast to Any">a</info>, <info descr="Automatically cast to String">a</info>)
|
||||
}
|
||||
fun illegalTupleReturnType(): (Any, String) = (<error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Any was expected">a</error>, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but String was expected">a</error>)
|
||||
if (a is String) {
|
||||
fun legalTupleReturnType(): (Any, String) = (<info descr="Automatically cast to Any">a</info>, <info descr="Automatically cast to String">a</info>)
|
||||
}
|
||||
val illegalFunctionLiteral: Function0<Int> = <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Function0<Any?> but Function0<Int> was expected">{ <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Int was expected">a</error> }</error>
|
||||
val illegalReturnValueInFunctionLiteral: Function0<Int> = { (): Int => <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Int was expected">a</error> }
|
||||
val <warning>illegalFunctionLiteral</warning>: Function0<Int> = <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Function0<Any?> but Function0<Int> was expected">{ <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Int was expected">a</error> }</error>
|
||||
val <warning>illegalReturnValueInFunctionLiteral</warning>: Function0<Int> = { (): Int => <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Int was expected">a</error> }
|
||||
|
||||
if (a is Int) {
|
||||
val legalFunctionLiteral: Function0<Int> = { <info descr="Automatically cast to Int">a</info> }
|
||||
val alsoLegalFunctionLiteral: Function0<Int> = { (): Int => <info descr="Automatically cast to Int">a</info> }
|
||||
val <warning>legalFunctionLiteral</warning>: Function0<Int> = { <info descr="Automatically cast to Int">a</info> }
|
||||
val <warning>alsoLegalFunctionLiteral</warning>: Function0<Int> = { (): Int => <info descr="Automatically cast to Int">a</info> }
|
||||
}
|
||||
}
|
||||
fun returnFunctionLiteralBlock(a: Any?): Function0<Int> {
|
||||
@@ -225,7 +225,7 @@ fun mergeAutocasts(a: Any?) {
|
||||
is String, is Any => a.<error descr="Unresolved reference: compareTo">compareTo</error>("")
|
||||
}
|
||||
if (a is String && a is Any) {
|
||||
val i: Int = <info descr="Automatically cast to String">a</info>.compareTo("")
|
||||
val <warning>i</warning>: Int = <info descr="Automatically cast to String">a</info>.compareTo("")
|
||||
}
|
||||
if (a is String && <info descr="Automatically cast to String">a</info>.compareTo("") == 0) {}
|
||||
if (a is String || a.<error descr="Unresolved reference: compareTo">compareTo</error>("") == 0) {}
|
||||
@@ -235,9 +235,9 @@ fun mergeAutocasts(a: Any?) {
|
||||
fun f(): String {
|
||||
var a: Any = 11
|
||||
if (a is String) {
|
||||
val i: String = <error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to String is impossible, because a could have changed since the is-check">a</error>
|
||||
val <warning>i</warning>: String = <error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to String is impossible, because a could have changed since the is-check">a</error>
|
||||
<error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to String is impossible, because a could have changed since the is-check">a</error>.compareTo("f")
|
||||
val f: Function0<String> = { <error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to String is impossible, because a could have changed since the is-check">a</error> }
|
||||
val <warning>f</warning>: Function0<String> = { <error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to String is impossible, because a could have changed since the is-check">a</error> }
|
||||
return <error descr="[AUTOCAST_IMPOSSIBLE] Automatic cast to String is impossible, because a could have changed since the is-check">a</error>
|
||||
}
|
||||
return ""
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
fun refs() {
|
||||
var <info>a</info> = 1
|
||||
val v = {
|
||||
<info>a</info> = 2
|
||||
var <info><warning>a</warning></info> = 1
|
||||
val <warning>v</warning> = {
|
||||
<info>a</info> = <warning>2</warning>
|
||||
}
|
||||
|
||||
var <info>x</info> = 1
|
||||
val b = object {
|
||||
var <info><warning>x</warning></info> = 1
|
||||
val <warning>b</warning> = object {
|
||||
fun foo() {
|
||||
<info>x</info> = 2
|
||||
<info>x</info> = <warning>2</warning>
|
||||
}
|
||||
}
|
||||
|
||||
var <info>y</info> = 1
|
||||
var <info><warning>y</warning></info> = 1
|
||||
fun foo() {
|
||||
<info>y</info> = 1
|
||||
<info>y</info> = <warning>1</warning>
|
||||
}
|
||||
}
|
||||
|
||||
fun refsPlusAssign() {
|
||||
var <info>a</info> = 1
|
||||
val v = {
|
||||
val <warning>v</warning> = {
|
||||
<info>a</info> += 2
|
||||
}
|
||||
|
||||
var <info>x</info> = 1
|
||||
val b = object {
|
||||
val <warning>b</warning> = object {
|
||||
fun foo() {
|
||||
<info>x</info> += 2
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ fun test() {
|
||||
var a : Any? = null
|
||||
if (a is Any) else a = null;
|
||||
while (a is Any) a = null
|
||||
while (true) a = null
|
||||
while (true) a = <warning>null</warning>
|
||||
}
|
||||
@@ -2,7 +2,7 @@ fun foo(u : Unit) : Int = 1
|
||||
|
||||
fun test() : Int {
|
||||
foo(<error>1</error>)
|
||||
val a : fun() : Unit = {
|
||||
val <warning>a</warning> : fun() : Unit = {
|
||||
foo(<error>1</error>)
|
||||
}
|
||||
return 1
|
||||
|
||||
@@ -32,7 +32,7 @@ fun evaluateAdd(expr: StringBuilder, numbers: ArrayList<Int>): Int {
|
||||
fun evaluate(expr: StringBuilder, numbers: ArrayList<Int>): Int {
|
||||
val lhs = evaluateAdd(expr, numbers)
|
||||
if (expr.length() > 0) {
|
||||
val c = expr.charAt(0)
|
||||
val <warning>c</warning> = expr.charAt(0)
|
||||
expr.deleteCharAt(0)
|
||||
}
|
||||
return lhs
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
fun foo1() : fun (Int) : Int = { (x: Int) => x }
|
||||
|
||||
fun foo() {
|
||||
val h : fun (Int) : Int = foo1();
|
||||
val <warning>h</warning> : fun (Int) : Int = foo1();
|
||||
h(1)
|
||||
val m : fun (Int) : Int = {(a : Int) => 1}//foo1()
|
||||
val <warning>m</warning> : fun (Int) : Int = {(a : Int) => 1}//foo1()
|
||||
m(1)
|
||||
}
|
||||
@@ -18,5 +18,5 @@ enum class Foo<T> {
|
||||
|
||||
|
||||
fun box() {
|
||||
val x: ProtocolState = ProtocolState.WAITING
|
||||
val <warning>x</warning>: ProtocolState = ProtocolState.WAITING
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
bar = 1
|
||||
this.bar
|
||||
1 : Int
|
||||
val a : Int =1
|
||||
val <warning>a</warning> : Int =1
|
||||
this : Foo
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user