Analysis API: introduce KtIntegerLiteralType
This commit is contained in:
committed by
TeamCityServer
parent
30b1487afc
commit
5c3ce67648
+1
@@ -359,6 +359,7 @@ internal class KtSymbolByFirBuilder private constructor(
|
||||
is ConeIntersectionType -> KtFirIntersectionType(coneType, token, this@KtSymbolByFirBuilder)
|
||||
is ConeDefinitelyNotNullType -> KtFirDefinitelyNotNullType(coneType, token, this@KtSymbolByFirBuilder)
|
||||
is ConeCapturedType -> KtFirCapturedType(coneType, token)
|
||||
is ConeIntegerLiteralType -> KtFirIntegerLiteralType(coneType, token, this@KtSymbolByFirBuilder)
|
||||
else -> throwUnexpectedElementError(coneType)
|
||||
}
|
||||
}
|
||||
|
||||
+22
@@ -200,6 +200,28 @@ internal class KtFirIntersectionType(
|
||||
override fun hashCode() = typeHashcode()
|
||||
}
|
||||
|
||||
internal class KtFirIntegerLiteralType(
|
||||
override val coneType: ConeIntegerLiteralType,
|
||||
override val token: ValidityToken,
|
||||
private val builder: KtSymbolByFirBuilder,
|
||||
) : KtIntegerLiteralType(), KtFirType {
|
||||
override val isUnsigned: Boolean get() = withValidityAssertion { coneType.isUnsigned }
|
||||
|
||||
override val value: Long get() = withValidityAssertion { coneType.value }
|
||||
|
||||
override val possibleTypes: List<KtClassType> by cached {
|
||||
coneType.possibleTypes.map { possibleType ->
|
||||
builder.typeBuilder.buildKtType(possibleType) as KtClassType
|
||||
}
|
||||
}
|
||||
|
||||
override val nullability: KtTypeNullability get() = withValidityAssertion { coneType.nullability.asKtNullability() }
|
||||
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { coneType.render() }
|
||||
override fun equals(other: Any?) = typeEquals(other)
|
||||
override fun hashCode() = typeHashcode()
|
||||
}
|
||||
|
||||
private fun ConeNullability.asKtNullability(): KtTypeNullability = when (this) {
|
||||
ConeNullability.NULLABLE -> KtTypeNullability.NULLABLE
|
||||
ConeNullability.UNKNOWN -> KtTypeNullability.UNKNOWN
|
||||
|
||||
Reference in New Issue
Block a user