Control-Flow Analysis: Reuse pseudo-value information for unused expression analysis

This commit is contained in:
Alexey Sedunov
2014-07-25 14:52:15 +04:00
parent 2a19016d58
commit 9cbcabffa4
55 changed files with 239 additions and 190 deletions
@@ -1,3 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
trait A
abstract class B
annotation class C
@@ -8,4 +9,4 @@ fun main() {
::<!CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS!>B<!>
::C // KT-3465
::<!INVISIBLE_MEMBER!>D<!>
}
}
@@ -1,3 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
fun foo(x: Int, <!UNUSED_PARAMETER!>y<!>: Any) = x
fun foo(<!UNUSED_PARAMETER!>x<!>: Any, y: Int) = y
@@ -5,4 +6,4 @@ fun main() {
::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!> : (Int, Any) -> Unit
}
}
@@ -1,3 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
// FILE: a.kt
package first
@@ -23,4 +24,4 @@ fun main() {
A::<!UNRESOLVED_REFERENCE!>baz<!>
x : KExtensionFunction0<A, Unit>
}
}
@@ -1,3 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
class A {
fun Int.extInt() = 42
fun A.extA(x: String) = x
@@ -11,4 +12,4 @@ class A {
fun main() {
A::<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>extInt<!>
A::<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>extA<!>
}
}
@@ -1,3 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
import A.Inner
class A {
@@ -6,4 +7,4 @@ class A {
fun main() {
::<!UNRESOLVED_REFERENCE!>Inner<!>
}
}
@@ -1,3 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
import kotlin.reflect.KMemberFunction0
class A {
@@ -28,4 +29,4 @@ class B {
y : KMemberFunction0<A, A.Inner>
}
}
}
@@ -1,3 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
import kotlin.reflect.KMemberFunction0
class A {
@@ -17,4 +18,4 @@ fun Int.main() {
val y = A::Inner
y : KMemberFunction0<A, A.Inner>
}
}
@@ -1,3 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
import kotlin.reflect.KMemberFunction0
class A {
@@ -9,4 +10,4 @@ fun main() {
val y = A::Inner
y : KMemberFunction0<A, A.Inner>
}
}
@@ -1,3 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
import kotlin.reflect.KFunction0
class A {
@@ -28,4 +29,4 @@ class B {
y : KFunction0<A.Nested>
}
}
}
@@ -1,3 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
import kotlin.reflect.KFunction0
class A {
@@ -16,4 +17,4 @@ fun Int.main() {
val y = A::Nested
y : KFunction0<A.Nested>
}
}
@@ -1,7 +1,8 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
fun bar() = 42
fun main() {
fun bar() = 239
::bar
}
}
@@ -1,3 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
class A
fun main() {
@@ -8,4 +9,4 @@ fun main() {
A::<!UNRESOLVED_REFERENCE!>bar<!>
<!UNRESOLVED_REFERENCE!>B<!>::<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>bar<!>
}
}