Minor: cleanup + support variance in ErrorListDiagnosticListRenderer
1. Support variance in ErrorListDiagnosticListRenderer. I will make some diagnostics to have covariant type arguments in the next commits 2. Drop unused code Review: https://jetbrains.team/p/kt/reviews/12750/timeline
This commit is contained in:
+6
@@ -13,6 +13,7 @@ import java.io.File
|
|||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
import kotlin.reflect.KType
|
import kotlin.reflect.KType
|
||||||
import kotlin.reflect.KTypeProjection
|
import kotlin.reflect.KTypeProjection
|
||||||
|
import kotlin.reflect.KVariance
|
||||||
|
|
||||||
object ErrorListDiagnosticListRenderer : DiagnosticListRenderer() {
|
object ErrorListDiagnosticListRenderer : DiagnosticListRenderer() {
|
||||||
const val BASE_PACKAGE = "org.jetbrains.kotlin.fir.analysis.diagnostics"
|
const val BASE_PACKAGE = "org.jetbrains.kotlin.fir.analysis.diagnostics"
|
||||||
@@ -116,6 +117,11 @@ object ErrorListDiagnosticListRenderer : DiagnosticListRenderer() {
|
|||||||
if (typeArgumentType == null) {
|
if (typeArgumentType == null) {
|
||||||
print("*")
|
print("*")
|
||||||
} else {
|
} else {
|
||||||
|
when (typeArgument.variance) {
|
||||||
|
KVariance.INVARIANT, null -> {}
|
||||||
|
KVariance.IN -> print("in ")
|
||||||
|
KVariance.OUT -> print("out ")
|
||||||
|
}
|
||||||
printType(typeArgumentType)
|
printType(typeArgumentType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-8
@@ -105,11 +105,3 @@ val ExpectActualCompatibility<*>.isCompatibleOrWeaklyIncompatible: Boolean
|
|||||||
|
|
||||||
val ExpectActualCompatibility<*>.compatible: Boolean
|
val ExpectActualCompatibility<*>.compatible: Boolean
|
||||||
get() = this == ExpectActualCompatibility.Compatible
|
get() = this == ExpectActualCompatibility.Compatible
|
||||||
|
|
||||||
@OptIn(ExperimentalContracts::class)
|
|
||||||
fun ExpectActualCompatibility<*>.isIncompatible(): Boolean {
|
|
||||||
contract {
|
|
||||||
returns(true) implies (this@isIncompatible is ExpectActualCompatibility.Incompatible<*>)
|
|
||||||
}
|
|
||||||
return !compatible
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user