[FE 1.0] Report warnings or errors for upper bounded type variables by an empty intersection type

This commit is contained in:
Victor Petukhov
2022-02-11 11:49:59 +03:00
committed by teamcity
parent 9474406375
commit 65213e9a42
25 changed files with 233 additions and 12 deletions
@@ -0,0 +1,12 @@
/selectFromCovariantAndContravariantTypes.kt:12:22: warning: parameter 'y' is never used
fun <K> select(x: K, y: K): K = x
^
/selectFromCovariantAndContravariantTypes.kt:13:19: warning: parameter 'x' is never used
fun <V> genericIn(x: In<V>) {}
^
/selectFromCovariantAndContravariantTypes.kt:14:20: warning: parameter 'x' is never used
fun <V> genericOut(x: Out<V>) {}
^
/selectFromCovariantAndContravariantTypes.kt:17:5: warning: type argument for a type parameter V can't be inferred because it's upper bounded by incompatible types: A, B. This will become an error in Kotlin 1.8
genericIn(select(a, b))
^
@@ -1,4 +1,4 @@
// FIR_IDENTICAL
// RENDER_DIAGNOSTICS_FULL_TEXT
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
@@ -13,7 +13,7 @@ fun <V> genericIn(x: In<V>) {}
fun <V> genericOut(x: Out<V>) {}
fun test1(a: In<A>, b: In<B>) {
genericIn(select(a, b))
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>genericIn<!>(select(a, b))
}
fun test2(a: Out<A>, b: Out<B>) {