Propagate control flow to bound double colon expressions
"Unused expression" should be reported on unused double colon expressions, this is postponed #KT-12551 Open
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
fun unusedExpression(s: String) {
|
||||
// TODO: report UNUSED_EXPRESSION (KT-12551)
|
||||
s::hashCode
|
||||
s::class
|
||||
}
|
||||
|
||||
fun noUnusedParameter(s: String): Int {
|
||||
val f = s::hashCode
|
||||
return f()
|
||||
}
|
||||
|
||||
fun unreachableCode(): Int {
|
||||
(if (true) return 1 else return 0)::toString
|
||||
<!UNREACHABLE_CODE!>return 0<!>
|
||||
}
|
||||
|
||||
fun unreachableCodeInLoop(): Int {
|
||||
while (true) {
|
||||
(break)::toString
|
||||
<!UNREACHABLE_CODE!>return 1<!>
|
||||
}
|
||||
return 2
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package
|
||||
|
||||
public fun noUnusedParameter(/*0*/ s: kotlin.String): kotlin.Int
|
||||
public fun unreachableCode(): kotlin.Int
|
||||
public fun unreachableCodeInLoop(): kotlin.Int
|
||||
public fun unusedExpression(/*0*/ s: kotlin.String): kotlin.Unit
|
||||
+1
-1
@@ -15,6 +15,6 @@ data class User(val surname: String)
|
||||
|
||||
fun foo() {
|
||||
bar<String> {
|
||||
<!UNUSED_EXPRESSION!><!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>User<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>surname<!><!>
|
||||
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>User<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>surname<!>
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user