[FIR] Add diagnostic CONFLICTING_PROJECTION
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
$TESTDATA_DIR$/conflictingProjection.kt
|
||||
-Xuse-fir
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
@@ -0,0 +1,19 @@
|
||||
class None<T>
|
||||
class In<in T>
|
||||
class Out<out T>
|
||||
|
||||
fun a1(value: None<Int>) {}
|
||||
fun a2(value: None<in Int>) {}
|
||||
fun a3(value: None<out Int>) {}
|
||||
|
||||
fun a7(value: Out<Int>) {}
|
||||
fun a8(value: Out<in Int>) {}
|
||||
fun a9(value: Out<out Int>) {}
|
||||
|
||||
typealias A1<K> = None<K>
|
||||
typealias A2<K> = None<in K>
|
||||
typealias A3<K> = None<out K>
|
||||
|
||||
typealias A13<in K> = In<K>
|
||||
typealias A14<in K> = In<in K>
|
||||
typealias A15<in K> = In<out K>
|
||||
@@ -0,0 +1,16 @@
|
||||
compiler/testData/cli/jvm/conflictingProjection.kt:10:15: error: projection is conflicting with variance of the corresponding type parameter of Out<in kotlin/Int>. Remove the projection or replace it with '*'
|
||||
fun a8(value: Out<in Int>) {}
|
||||
^
|
||||
compiler/testData/cli/jvm/conflictingProjection.kt:17:15: error: variance annotations are only allowed for type parameters of classes and interfaces
|
||||
typealias A13<in K> = In<K>
|
||||
^
|
||||
compiler/testData/cli/jvm/conflictingProjection.kt:18:15: error: variance annotations are only allowed for type parameters of classes and interfaces
|
||||
typealias A14<in K> = In<in K>
|
||||
^
|
||||
compiler/testData/cli/jvm/conflictingProjection.kt:19:15: error: variance annotations are only allowed for type parameters of classes and interfaces
|
||||
typealias A15<in K> = In<out K>
|
||||
^
|
||||
compiler/testData/cli/jvm/conflictingProjection.kt:19:23: error: projection is conflicting with variance of the corresponding type parameter of In<out K>. Remove the projection or replace it with '*'
|
||||
typealias A15<in K> = In<out K>
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
Reference in New Issue
Block a user