[FIR/NI] Refactor type variable gathering from lambda types
Motivation: - drop getArguments from type context as a duplicate of getArgumentList - reduce the number of collection allocations in getAllDeeplyRelatedTypeVariables Additional minor improvements, test data fixes
This commit is contained in:
@@ -246,7 +246,6 @@ interface TypeSystemContext : TypeSystemOptimizationContext {
|
||||
|
||||
fun KotlinTypeMarker.argumentsCount(): Int
|
||||
fun KotlinTypeMarker.getArgument(index: Int): TypeArgumentMarker
|
||||
fun KotlinTypeMarker.getArguments(): List<TypeArgumentMarker>
|
||||
|
||||
fun SimpleTypeMarker.getArgumentOrNull(index: Int): TypeArgumentMarker? {
|
||||
if (index in 0 until argumentsCount()) return getArgument(index)
|
||||
@@ -341,6 +340,18 @@ interface TypeSystemContext : TypeSystemOptimizationContext {
|
||||
}
|
||||
}
|
||||
|
||||
operator fun TypeArgumentListMarker.iterator() = object : Iterator<TypeArgumentMarker> {
|
||||
private var argumentIndex: Int = 0
|
||||
|
||||
override fun hasNext(): Boolean = argumentIndex < size()
|
||||
|
||||
override fun next(): TypeArgumentMarker {
|
||||
val argument = get(argumentIndex)
|
||||
argumentIndex += 1
|
||||
return argument
|
||||
}
|
||||
}
|
||||
|
||||
fun TypeConstructorMarker.isAnyConstructor(): Boolean
|
||||
fun TypeConstructorMarker.isNothingConstructor(): Boolean
|
||||
|
||||
|
||||
Reference in New Issue
Block a user