Add KtTypeElement.unwrapNullability() extension function
Replace similar functions with its usage
This commit is contained in:
@@ -676,3 +676,11 @@ fun getTrailingCommaByElementsList(elementList: PsiElement?): PsiElement? {
|
||||
|
||||
val KtNameReferenceExpression.isUnderscoreInBackticks
|
||||
get() = getReferencedName() == "`_`"
|
||||
|
||||
tailrec fun KtTypeElement.unwrapNullability(): KtTypeElement? {
|
||||
return when (this) {
|
||||
is KtNullableType -> this.innerType?.unwrapNullability()
|
||||
is KtDefinitelyNotNullType -> this.innerType?.unwrapNullability()
|
||||
else -> this
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user