[FIR] Introduce ConeStubType to have subtyping for non-fixed variables
Currently, it's needed after changes in d7b47108f70a107818a04c8b8db33bfbf7c7e590 Later it'll be also used for builder-inference
This commit is contained in:
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.types
|
||||
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
|
||||
import org.jetbrains.kotlin.fir.symbols.ConeClassifierLookupTag
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.types.model.*
|
||||
|
||||
sealed class ConeKotlinTypeProjection : TypeArgumentMarker {
|
||||
@@ -193,3 +194,17 @@ class ConeIntersectionType(
|
||||
fun ConeIntersectionType.mapTypes(func: (ConeKotlinType) -> ConeKotlinType): ConeIntersectionType {
|
||||
return ConeIntersectionType(intersectedTypes.map(func))
|
||||
}
|
||||
|
||||
class ConeStubType(val variable: ConeTypeVariable, override val nullability: ConeNullability) : StubTypeMarker, ConeKotlinType() {
|
||||
override val typeArguments: Array<out ConeKotlinTypeProjection>
|
||||
get() = emptyArray()
|
||||
}
|
||||
|
||||
open class ConeTypeVariable(name: String) : TypeVariableMarker {
|
||||
val typeConstructor = ConeTypeVariableTypeConstructor(name)
|
||||
val defaultType = ConeTypeVariableType(ConeNullability.NOT_NULL, typeConstructor)
|
||||
}
|
||||
|
||||
class ConeTypeVariableTypeConstructor(val debugName: String) : ConeClassifierLookupTag(), TypeVariableTypeConstructorMarker {
|
||||
override val name: Name get() = Name.identifier(debugName)
|
||||
}
|
||||
|
||||
@@ -46,5 +46,6 @@ fun ConeKotlinType.render(): String {
|
||||
postfix = ")"
|
||||
)
|
||||
}
|
||||
is ConeStubType -> "stub type: $variable"
|
||||
} + nullabilitySuffix
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user