Do not show warning about useless elvis for error function types

#KT-17214 Fixed
 #KT-12112 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2017-04-03 02:57:03 +03:00
parent 3cdf6c898a
commit 1e56815b3b
4 changed files with 12 additions and 2 deletions
@@ -35,10 +35,14 @@ fun test() {
takeNotNull(dependOn(dependOn(x)) <!USELESS_ELVIS!>?: ""<!>)
takeNotNull(dependOn(dependOn(x) <!USELESS_CAST!>as? String<!>) ?: "")
}
takeNotNull(bar()!!)
}
inline fun <reified T : Any> reifiedNull(): T? = null
fun testFrom13648() {
takeNotNull(reifiedNull() ?: "")
}
}
fun bar() = <!UNRESOLVED_REFERENCE!>unresolved<!>
@@ -1,5 +1,6 @@
package
public fun bar(): [ERROR : Error function type]
public fun </*0*/ T> dependOn(/*0*/ x: T): T
public fun </*0*/ T> notNull(): T
public fun </*0*/ T> nullable(): T?
@@ -61,6 +61,7 @@ fun test() {
takeNotNull(J.getNAny() ?: J())
val x = <!UNRESOLVED_REFERENCE!>unresolved<!> ?: null
<!UNREACHABLE_CODE!>val y =<!> <!UNRESOLVED_REFERENCE!>unresolved<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>foo<!> ?: return
}
fun takeNotNull(s: J) {}