K2: Avoid losing diagnostics for synthetic calls

Some of the changed tests may duplicate other existing diagnostics,
but that should not be reason not to report them at all.

There might be another job to be done to avoid diagnostic duplications
This commit is contained in:
Denis.Zharkov
2022-11-23 13:19:43 +01:00
committed by Space Team
parent fe5adab652
commit d7399ed1cf
31 changed files with 97 additions and 74 deletions
@@ -136,7 +136,7 @@ fun poll16(flag: Boolean): Flow<String> {
fun poll17(flag: Boolean): Flow<String> {
return flow {
val inv = if (flag) { foo7() } else { ::Foo7 }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>if (flag) { foo7() } else { ::Foo7 }<!>
inv
}
}
@@ -185,7 +185,7 @@ fun poll25(flag: Boolean): Flow<String> {
fun poll26(flag: Boolean): Flow<String> {
return flow {
val inv = when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 }<!>
inv
}
}
@@ -234,7 +234,7 @@ fun poll35(flag: Boolean): Flow<String> {
fun poll36(flag: Boolean): Flow<String> {
return flow {
val inv = when (flag) { true -> ::Foo7 false -> foo7() }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>when (flag) { true -> ::Foo7 false -> foo7() }<!>
inv
}
}
@@ -332,7 +332,7 @@ fun poll55(): Flow<String> {
fun poll56(): Flow<String> {
return flow {
val inv = try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() }<!>
inv
}
}
@@ -430,7 +430,7 @@ fun poll75(): Flow<String> {
fun poll76(): Flow<String> {
return flow {
val inv = ::Foo7<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::Foo7<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!><!>
inv
}
}
@@ -85,7 +85,7 @@ fun poll16(flag: Boolean): Flow<String> {
fun poll17(flag: Boolean): Flow<String> {
return flow {
val inv = if (flag) { foo7() } else { ::Foo7 }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>if (flag) { foo7() } else { ::Foo7 }<!>
inv
}
}
@@ -183,7 +183,7 @@ fun poll55(): Flow<String> {
fun poll56(): Flow<String> {
return flow {
val inv = try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() }<!>
inv
}
}
@@ -79,7 +79,7 @@ fun poll75(): Flow<String> {
fun poll76(): Flow<String> {
return flow {
val inv = ::Foo7<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::Foo7<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!><!>
inv
}
}
@@ -80,7 +80,7 @@ fun poll75(): Flow<String> {
fun poll76(): Flow<String> {
return flow {
val inv = ::Foo7<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::Foo7<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!><!>
inv
}
}
@@ -138,7 +138,7 @@ fun poll16(flag: Boolean): Flow<String> {
fun poll17(flag: Boolean): Flow<String> {
return flow {
val inv = if (flag) { foo7() } else { ::Foo7 }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>if (flag) { foo7() } else { ::Foo7 }<!>
inv
}
}
@@ -187,7 +187,7 @@ fun poll25(flag: Boolean): Flow<String> {
fun poll26(flag: Boolean): Flow<String> {
return flow {
val inv = when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 }<!>
inv
}
}
@@ -236,7 +236,7 @@ fun poll35(flag: Boolean): Flow<String> {
fun poll36(flag: Boolean): Flow<String> {
return flow {
val inv = when (flag) { true -> ::Foo7 false -> foo7() }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>when (flag) { true -> ::Foo7 false -> foo7() }<!>
inv
}
}
@@ -334,7 +334,7 @@ fun poll55(): Flow<String> {
fun poll56(): Flow<String> {
return flow {
val inv = try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() }<!>
inv
}
}
@@ -432,7 +432,7 @@ fun poll75(): Flow<String> {
fun poll76(): Flow<String> {
return flow {
val inv = ::Foo7<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::Foo7<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!><!>
inv
}
}
@@ -8,9 +8,9 @@ fun main() {
val x3: () -> String = if (true) {{ -> "this" }} else {{ -> "this" }}
val x4: String.() -> String = if (true) {{ str: String -> "this" }} else {{ str: String -> "this" }}
val x41: String.(String) -> String = if (true) {{ str: String, str2: String -> "this" }} else {{ str: String, str2: String -> "this" }}
val x42: String.(String) -> String = if (true) {{ str, <!CANNOT_INFER_PARAMETER_TYPE!>str2<!> -> "this" }} else {{ str, <!CANNOT_INFER_PARAMETER_TYPE!>str2<!> -> "this" }}
val x5: String.() -> String = if (true) {{ <!CANNOT_INFER_PARAMETER_TYPE!>str<!> -> "this" }} else {{ <!CANNOT_INFER_PARAMETER_TYPE!>str<!> -> "this" }}
val x6: String.() -> String = if (true) {{ <!CANNOT_INFER_PARAMETER_TYPE!>str<!> -> "this" }} else {{ "this" }}
val x42: String.(String) -> String = if (true) {<!ARGUMENT_TYPE_MISMATCH!>{ str, <!CANNOT_INFER_PARAMETER_TYPE!>str2<!> -> "this" }<!>} else {<!ARGUMENT_TYPE_MISMATCH!>{ str, <!CANNOT_INFER_PARAMETER_TYPE!>str2<!> -> "this" }<!>}
val x5: String.() -> String = if (true) {<!ARGUMENT_TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE!>str<!> -> "this" }<!>} else {<!ARGUMENT_TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE!>str<!> -> "this" }<!>}
val x6: String.() -> String = if (true) {<!ARGUMENT_TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE!>str<!> -> "this" }<!>} else {{ "this" }}
val x7: String.() -> String = select({ -> this }, { -> this })
val x8: String.() -> String = select({ this }, { this })
}
@@ -15,6 +15,6 @@ fun buildTree(segments: List<Interval>): IntervalTree? = TODO()
fun acquireIntervals(): List<Interval> = TODO()
fun main() {
buildTree(acquireIntervals())
?: emptyList()
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildTree(acquireIntervals())
?: emptyList()<!>
}
@@ -4,5 +4,5 @@ class Inv<I>
fun <T> create(): Inv<T> = TODO()
fun main() {
if (true) create() else null
<!NEW_INFERENCE_ERROR!>if (true) create() else null<!>
}
@@ -4,21 +4,21 @@ import java.lang.Exception
fun <K> id(arg: K): K = arg
fun test() {
id(<!UNRESOLVED_REFERENCE!>unresolved<!>)!!
<!UNRESOLVED_REFERENCE!>unresolved<!>!!!!
try {
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>id(<!UNRESOLVED_REFERENCE!>unresolved<!>)!!<!>
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!UNRESOLVED_REFERENCE!>unresolved<!>!!!!<!>
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>try {
id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
} catch (e: Exception) {
id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
}
}<!>
if (true)
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>if (true)
id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
else
id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
id(<!UNRESOLVED_REFERENCE!>unresolved<!>)<!>
when {
true -> id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
}
id(<!UNRESOLVED_REFERENCE!>unresolved<!>) ?: id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>id(<!UNRESOLVED_REFERENCE!>unresolved<!>) ?: id(<!UNRESOLVED_REFERENCE!>unresolved<!>)<!>
}
@@ -12,7 +12,7 @@ fun <T> emptyList() : List<T>? = ArrayList<T>()
fun foo() {
// type arguments shouldn't be required
val l : List<Int> = emptyList()!!
val l1 = emptyList()!!
val l1 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>emptyList()!!<!>
checkSubtype<List<Int>>(emptyList()!!)
checkSubtype<List<Int>?>(emptyList())
@@ -9,21 +9,21 @@ class Foo7<T>
fun foo7() = null as Foo7<Int>
fun poll17(flag: Boolean): Any? {
val inv = if (flag) { foo7() } else { ::Foo7 }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>if (flag) { foo7() } else { ::Foo7 }<!>
return inv
}
fun poll26(flag: Boolean): Any? {
val inv = when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 }<!>
return inv
}
fun poll36(flag: Boolean): Any? {
val inv = when (flag) { true -> ::Foo7 false -> foo7() }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>when (flag) { true -> ::Foo7 false -> foo7() }<!>
return inv
}
fun poll56(): Any? {
val inv = try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() }<!>
return inv
}
@@ -44,7 +44,7 @@ fun poll13(flag: Boolean) {
}
fun poll14(flag: Boolean) {
val inv = if (flag) { ::bar4 } else { ::foo4 }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>if (flag) { ::bar4 } else { ::foo4 }<!>
<!NO_VALUE_FOR_PARAMETER!>inv()<!>
}
@@ -59,7 +59,7 @@ fun poll16(flag: Boolean) {
}
fun poll17(flag: Boolean) {
val inv = if (flag) { foo7() } else { ::Foo7 }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>if (flag) { foo7() } else { ::Foo7 }<!>
inv
}
@@ -79,7 +79,7 @@ fun poll22(flag: Boolean) {
}
fun poll23(flag: Boolean) {
val inv = when (flag) { true -> ::bar4 else -> ::foo4 }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>when (flag) { true -> ::bar4 else -> ::foo4 }<!>
<!NO_VALUE_FOR_PARAMETER!>inv()<!>
}
@@ -94,7 +94,7 @@ fun poll25(flag: Boolean) {
}
fun poll26(flag: Boolean) {
val inv = when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 }<!>
inv
}
@@ -114,7 +114,7 @@ fun poll32(flag: Boolean) {
}
fun poll33(flag: Boolean) {
val inv = when (flag) { true -> ::bar4 false -> ::foo4 }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>when (flag) { true -> ::bar4 false -> ::foo4 }<!>
<!NO_VALUE_FOR_PARAMETER!>inv()<!>
}
@@ -129,7 +129,7 @@ fun poll35(flag: Boolean) {
}
fun poll36(flag: Boolean) {
val inv = when (flag) { true -> ::Foo7 false -> foo7() }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>when (flag) { true -> ::Foo7 false -> foo7() }<!>
inv
}
@@ -149,7 +149,7 @@ fun poll42() {
}
fun poll43() {
val inv = try { ::bar4 } finally { ::foo4 }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>try { ::bar4 } finally { ::foo4 }<!>
<!NO_VALUE_FOR_PARAMETER!>inv()<!>
}
@@ -184,7 +184,7 @@ fun poll52() {
}
fun poll53() {
val inv = try { ::bar4 } catch (e: Exception) { ::foo4 } finally { ::foo4 }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>try { ::bar4 } catch (e: Exception) { ::foo4 } finally { ::foo4 }<!>
<!NO_VALUE_FOR_PARAMETER!>inv()<!>
}
@@ -199,7 +199,7 @@ fun poll55() {
}
fun poll56() {
val inv = try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() }
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() }<!>
inv
}
@@ -254,7 +254,7 @@ fun poll72() {
}
fun poll73() {
val inv = ::bar4<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::bar4<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!><!>
inv
}
@@ -269,7 +269,7 @@ fun poll75() {
}
fun poll76() {
val inv = ::Foo7<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::Foo7<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!><!>
inv
}