FIR: Report INFERENCE_NO_INFORMATION_FOR_PARAMETER diagnostic

This commit is contained in:
Denis.Zharkov
2021-05-25 10:33:46 +03:00
committed by TeamCityServer
parent 6e901e3785
commit c420957eac
34 changed files with 143 additions and 236 deletions
@@ -1,11 +0,0 @@
fun <T: Any> fooT22() : T? {
return null
}
fun foo1() {
fooT22()
}
val n : Nothing = null.sure()
fun <T : Any> T?.sure() : T = this!!
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun <T: Any> fooT22() : T? {
return null
}
@@ -1,14 +0,0 @@
package noInformationForParameter
//+JDK
import java.util.*
fun test() {
val n = newList()
val n1 : List<String> = newList()
}
fun <S> newList() : ArrayList<S> {
return ArrayList<S>()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package noInformationForParameter
//+JDK
@@ -1,11 +0,0 @@
// !DIAGNOSTICS: -UNREACHABLE_CODE
//KT-2445 Calling method with function with generic parameter causes compile-time exception
package a
fun main() {
test {
}
}
fun <R> test(callback: (R) -> Unit):Unit = callback(null!!)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNREACHABLE_CODE
//KT-2445 Calling method with function with generic parameter causes compile-time exception
package a
@@ -1,10 +0,0 @@
//KT-832 Provide better diagnostics when type inference fails for an expression that returns a function
package a
fun <T> fooT2() : (t : T) -> T {
return {it}
}
fun test() {
fooT2()(1) // here 1 should not be marked with an error
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
//KT-832 Provide better diagnostics when type inference fails for an expression that returns a function
package a