You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After updating from Detekt 1.22.0-RC1 to 1.22.0-RC2 invalid UnreachableCode violations are showing
Expected Behavior
Code called from external libraries should not cause UnreachableCode
Observed Behavior
Any code called from an external library in an ?: operator causes UnreachableCode
Steps to Reproduce
Run ./gradlew detektDebug
Error:
Test.kt:13:9: This expression is unreachable code which should either be used or removed. [UnreachableCode]
Sample Code (Failing code on line 11, Workaround code on line 12)
package org.test
import androidx.core.net.toUri
class Test {
fun testBug() {
getLastPathSegment("test.mp4")
}
private fun getLastPathSegment(uriText: String) {
val uri = uriText.toUri() // causes UnreachableCode.... code ref in core-ktx-1.5.0.jar: public inline fun String.toUri(): Uri = Uri.parse(this))
// val uri = Uri.parse(uriText) // does NOT cause UnreachableCode (copied code from core-ktx-1.5.0.jar)
val lastPath = uri.lastPathSegment ?: return
println(lastPath)
}
}
Your Environment
Detekt 1.2.2.0-RC2
Seen this same issue in many projects on different dev environments
The text was updated successfully, but these errors were encountered:
After updating from Detekt 1.22.0-RC1 to 1.22.0-RC2 invalid UnreachableCode violations are showing
Expected Behavior
Code called from external libraries should not cause UnreachableCode
Observed Behavior
Any code called from an external library in an ?: operator causes UnreachableCode
Steps to Reproduce
Run ./gradlew detektDebug
Error:
Test.kt:13:9: This expression is unreachable code which should either be used or removed. [UnreachableCode]
Sample Code (Failing code on line 11, Workaround code on line 12)
Your Environment
Detekt 1.2.2.0-RC2
Seen this same issue in many projects on different dev environments
The text was updated successfully, but these errors were encountered: