[FE] Support reporting INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION for empty intersection types with type parameters
This commit is contained in:
committed by
teamcity
parent
c16ae81a48
commit
b96708c3e2
+4
-4
@@ -1,12 +1,12 @@
|
||||
/selectFromCovariantAndContravariantTypes.kt:12:22: warning: parameter 'y' is never used
|
||||
/selectFromCovariantAndContravariantTypes.kt:11: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
|
||||
/selectFromCovariantAndContravariantTypes.kt:12:19: warning: parameter 'x' is never used
|
||||
fun <V> genericIn(x: In<V>) {}
|
||||
^
|
||||
/selectFromCovariantAndContravariantTypes.kt:14:20: warning: parameter 'x' is never used
|
||||
/selectFromCovariantAndContravariantTypes.kt:13: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
|
||||
/selectFromCovariantAndContravariantTypes.kt:16: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,6 +1,6 @@
|
||||
/kt45461.kt:6:25: warning: parameter 'foo' is never used
|
||||
/kt45461.kt:5:25: warning: parameter 'foo' is never used
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
^
|
||||
/kt45461.kt:11:19: warning: type argument for a type parameter S can't be inferred because it's upper bounded by incompatible types: String, Int. This will become an error in Kotlin 1.8
|
||||
/kt45461.kt:10:19: warning: type argument for a type parameter S can't be inferred because it's upper bounded by incompatible types: String, Int. This will become an error in Kotlin 1.8
|
||||
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
|
||||
^
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/kt45461_2.kt:5:25: warning: parameter 'foo' is never used
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
^
|
||||
/kt45461_2.kt:8:10: warning: 'Int' is a final type, and thus a value of the type parameter is predetermined
|
||||
fun <K : Int> main() {
|
||||
^
|
||||
/kt45461_2.kt:10:19: warning: type argument for a type parameter S can't be inferred because it's upper bounded by incompatible types: String, K. This will become an error in Kotlin 1.8
|
||||
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
|
||||
^
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// RENDER_DIAGNOSTICS_FULL_TEXT
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
fun <K : <!FINAL_UPPER_BOUND!>Int<!>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<String>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// RENDER_DIAGNOSTICS_FULL_TEXT
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
fun <K : <!FINAL_UPPER_BOUND!>Int<!>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<String>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ K : kotlin.Int> main(): kotlin.Unit
|
||||
|
||||
public final class Bar</*0*/ T> {
|
||||
public constructor Bar</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun </*0*/ S : T> takeFoo(/*0*/ foo: Foo<in S>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo</*0*/ T> {
|
||||
public constructor Foo</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// FIR_IDENTICAL
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
fun <K : <!FINAL_UPPER_BOUND!>String<!>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ K : kotlin.String> main(): kotlin.Unit
|
||||
|
||||
public final class Bar</*0*/ T> {
|
||||
public constructor Bar</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun </*0*/ S : T> takeFoo(/*0*/ foo: Foo<in S>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo</*0*/ T> {
|
||||
public constructor Foo</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// FIR_IDENTICAL
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
fun <K : CharSequence> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ K : kotlin.CharSequence> main(): kotlin.Unit
|
||||
|
||||
public final class Bar</*0*/ T> {
|
||||
public constructor Bar</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun </*0*/ S : T> takeFoo(/*0*/ foo: Foo<in S>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo</*0*/ T> {
|
||||
public constructor Foo</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/kt45461_5.kt:5:25: warning: parameter 'foo' is never used
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
^
|
||||
/kt45461_5.kt:8:23: warning: 'Int' is a final type, and thus a value of the type parameter is predetermined
|
||||
fun <K : L, L : N, N: Int> main() {
|
||||
^
|
||||
/kt45461_5.kt:10:19: warning: type argument for a type parameter S can't be inferred because it's upper bounded by incompatible types: String, K. This will become an error in Kotlin 1.8
|
||||
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
|
||||
^
|
||||
@@ -0,0 +1,11 @@
|
||||
// RENDER_DIAGNOSTICS_FULL_TEXT
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
fun <K : L, L : N, N: <!FINAL_UPPER_BOUND!>Int<!>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<String>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// RENDER_DIAGNOSTICS_FULL_TEXT
|
||||
class Foo<T>
|
||||
|
||||
class Bar<T> {
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
}
|
||||
|
||||
fun <K : L, L : N, N: <!FINAL_UPPER_BOUND!>Int<!>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<String>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ K : L, /*1*/ L : N, /*2*/ N : kotlin.Int> main(): kotlin.Unit
|
||||
|
||||
public final class Bar</*0*/ T> {
|
||||
public constructor Bar</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun </*0*/ S : T> takeFoo(/*0*/ foo: Foo<in S>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo</*0*/ T> {
|
||||
public constructor Foo</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
/kt48765.kt:5:44: warning: parameter 'x1' is never used
|
||||
/kt48765.kt:4:44: warning: parameter 'x1' is never used
|
||||
fun <T1: Number, T2: A<Float, T1>> foo(x1: T2, x2: T1) {}
|
||||
^
|
||||
/kt48765.kt:5:52: warning: parameter 'x2' is never used
|
||||
/kt48765.kt:4:52: warning: parameter 'x2' is never used
|
||||
fun <T1: Number, T2: A<Float, T1>> foo(x1: T2, x2: T1) {}
|
||||
^
|
||||
/kt48765.kt:9:13: warning: type argument for a type parameter T can't be inferred because it's upper bounded by incompatible types: String, Number. This will become an error in Kotlin 1.8
|
||||
/kt48765.kt:8:13: warning: type argument for a type parameter T can't be inferred because it's upper bounded by incompatible types: String, Number. This will become an error in Kotlin 1.8
|
||||
B().foo(x, foo())
|
||||
^
|
||||
/kt48765.kt:13:9: warning: 'String' is a final type, and thus a value of the type parameter is predetermined
|
||||
/kt48765.kt:12:9: warning: 'String' is a final type, and thus a value of the type parameter is predetermined
|
||||
fun <T: String> foo(): T {
|
||||
^
|
||||
/kt48765.kt:14:15: warning: unchecked cast: String to T
|
||||
/kt48765.kt:13:15: warning: unchecked cast: String to T
|
||||
return "" as T // this cast is safe because String is final.
|
||||
^
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/kt48935.kt:7:35: warning: parameter 'func' is never used
|
||||
/kt48935.kt:6:35: warning: parameter 'func' is never used
|
||||
fun <T, V> exampleGenericFunction(func: V) where T: Base, V: (T) -> Unit {
|
||||
^
|
||||
/kt48935.kt:13:5: warning: type argument for a type parameter T can't be inferred because it's upper bounded by incompatible types: Base, DoesNotImplementBase. This will become an error in Kotlin 1.8
|
||||
/kt48935.kt:12:5: warning: type argument for a type parameter T can't be inferred because it's upper bounded by incompatible types: Base, DoesNotImplementBase. This will become an error in Kotlin 1.8
|
||||
exampleGenericFunction(func) // expected this to be a compilation error as the T: Base constraint should not be satisfied
|
||||
^
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/kt49661.kt:11:5: warning: type argument for a type parameter T can't be inferred because it's upper bounded by incompatible types: Foo, Int. This will become an error in Kotlin 1.8
|
||||
/kt49661.kt:10:5: warning: type argument for a type parameter T can't be inferred because it's upper bounded by incompatible types: Foo, Int. This will become an error in Kotlin 1.8
|
||||
f<Int> { g() }
|
||||
^
|
||||
|
||||
|
||||
Reference in New Issue
Block a user