Fix some compiler warnings in FIR modules
This commit is contained in:
@@ -66,7 +66,7 @@ enum class ProcessorAction {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun FirScope.processClassifiersByName(
|
||||
name: Name,
|
||||
noinline processor: (FirClassifierSymbol<*>) -> Unit
|
||||
|
||||
+10
-8
@@ -7,36 +7,38 @@ package org.jetbrains.kotlin.fir.visitors
|
||||
|
||||
import org.jetbrains.kotlin.fir.FirElement
|
||||
|
||||
sealed class CompositeTransformResult<out T : Any>() {
|
||||
sealed class CompositeTransformResult<out T : Any> {
|
||||
|
||||
class Single<out T : Any>(val _single: T) : CompositeTransformResult<T>()
|
||||
|
||||
class Multiple<out T : Any>(val _list: List<T>) : CompositeTransformResult<T>()
|
||||
|
||||
companion object {
|
||||
fun <T : Any> empty() = CompositeTransformResult.Multiple<T>(emptyList<T>())
|
||||
fun <T : Any> single(t: T) = CompositeTransformResult.Single(t)
|
||||
fun <T : Any> many(l: List<T>) = CompositeTransformResult.Multiple(l)
|
||||
fun <T : Any> empty() = Multiple(emptyList<T>())
|
||||
fun <T : Any> single(t: T) = Single(t)
|
||||
fun <T : Any> many(l: List<T>) = Multiple(l)
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val list: List<T>
|
||||
get() = when (this) {
|
||||
is CompositeTransformResult.Multiple<*> -> _list as List<T>
|
||||
is Multiple<*> -> _list as List<T>
|
||||
else -> error("!")
|
||||
}
|
||||
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val single: T
|
||||
get() = when (this) {
|
||||
is CompositeTransformResult.Single<*> -> _single as T
|
||||
is Single<*> -> _single as T
|
||||
else -> error("!")
|
||||
}
|
||||
|
||||
val isSingle
|
||||
get() = this is CompositeTransformResult.Single<*>
|
||||
get() = this is Single<*>
|
||||
|
||||
val isEmpty
|
||||
get() = this is CompositeTransformResult.Multiple<*> && this.list.isEmpty()
|
||||
get() = this is Multiple<*> && this.list.isEmpty()
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ fun SmartPrinter.printImplementation(implementation: Implementation) {
|
||||
}
|
||||
println("(")
|
||||
withIndent {
|
||||
fieldsWithoutDefault.forEachIndexed { i, field ->
|
||||
fieldsWithoutDefault.forEachIndexed { _, field ->
|
||||
printField(field, isImplementation = true, override = true, end = ",")
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -52,9 +52,11 @@ private fun updateKinds(solution: List<Boolean>, elementMapping: ElementMapping)
|
||||
val element = elementMapping[index * 2].origin
|
||||
val existingKind = element.kind
|
||||
if (isClass) {
|
||||
when (existingKind) {
|
||||
Implementation.Kind.Interface -> throw IllegalStateException(element.toString())
|
||||
null -> element.kind = when (element) {
|
||||
if (existingKind == Implementation.Kind.Interface)
|
||||
throw IllegalStateException(element.toString())
|
||||
|
||||
if (existingKind == null) {
|
||||
element.kind = when (element) {
|
||||
is Implementation -> {
|
||||
if (elementMapping.hasInheritors(element))
|
||||
Implementation.Kind.AbstractClass
|
||||
|
||||
Reference in New Issue
Block a user