Skip to content

Commit 27ae856

Browse files
committed
Fix warnings in KSTypeImpl
1 parent f79ac52 commit 27ae856

File tree

1 file changed

+7
-6
lines changed
  • kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/kotlin

1 file changed

+7
-6
lines changed

kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/kotlin/KSTypeImpl.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ class KSTypeImpl private constructor(internal val type: KaType) : KSType {
7070

7171
override val nullability: Nullability by lazy {
7272
when {
73-
type is KaFlexibleType && type.lowerBound.nullability != type.upperBound.nullability -> Nullability.PLATFORM
74-
analyze { type.canBeNull } -> Nullability.NULLABLE
73+
type is KaFlexibleType && analyze {
74+
!type.lowerBound.isMarkedNullable && type.upperBound.isMarkedNullable
75+
} -> Nullability.PLATFORM
76+
analyze { type.isNullable } -> Nullability.NULLABLE
7577
else -> Nullability.NOT_NULL
7678
}
7779
}
@@ -137,18 +139,17 @@ class KSTypeImpl private constructor(internal val type: KaType) : KSType {
137139

138140
override fun makeNullable(): KSType {
139141
return analyze {
140-
getCached(type.withNullability(KaTypeNullability.NULLABLE))
142+
getCached(type.withNullability(isMarkedNullable = true))
141143
}
142144
}
143145

144146
override fun makeNotNullable(): KSType {
145147
return analyze {
146-
getCached(type.withNullability(KaTypeNullability.NON_NULLABLE))
148+
getCached(type.withNullability(isMarkedNullable = false))
147149
}
148150
}
149151

150-
override val isMarkedNullable: Boolean
151-
get() = type.nullability == KaTypeNullability.NULLABLE
152+
override val isMarkedNullable: Boolean = analyze { type.isMarkedNullable }
152153

153154
override val isError: Boolean
154155
// TODO: non exist type returns KtNonErrorClassType, check upstream for KtClassErrorType usage.

0 commit comments

Comments
 (0)