FIR Java: record Java types with flexible nullability
This commit is contained in:
committed by
teamcityserver
parent
1f48092ec1
commit
fc7f589caa
@@ -105,8 +105,12 @@ fun ConeTypeContext.hasNullableSuperType(type: ConeKotlinType): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
fun <T : ConeKotlinType> T.withNullability(nullability: ConeNullability, typeContext: ConeInferenceContext? = null): T {
|
||||
if (this.nullability == nullability) {
|
||||
fun <T : ConeKotlinType> T.withNullability(
|
||||
nullability: ConeNullability,
|
||||
typeContext: ConeInferenceContext? = null,
|
||||
attributes: ConeAttributes = this.attributes,
|
||||
): T {
|
||||
if (this.nullability == nullability && this.attributes == attributes) {
|
||||
return this
|
||||
}
|
||||
|
||||
@@ -188,6 +192,9 @@ fun FirTypeRef.isUnsafeVarianceType(session: FirSession): Boolean {
|
||||
fun FirTypeRef.hasEnhancedNullability(): Boolean =
|
||||
coneTypeSafe<ConeKotlinType>()?.hasEnhancedNullability == true
|
||||
|
||||
fun FirTypeRef.hasFlexibleNullability(): Boolean =
|
||||
coneTypeSafe<ConeKotlinType>()?.hasFlexibleNullability == true
|
||||
|
||||
fun FirTypeRef.withoutEnhancedNullability(): FirTypeRef {
|
||||
require(this is FirResolvedTypeRef)
|
||||
if (!hasEnhancedNullability()) return this
|
||||
|
||||
Reference in New Issue
Block a user