Add KtTypeElement.unwrapNullability() extension function

Replace similar functions with its usage
This commit is contained in:
Roman Golyshev
2021-04-30 19:42:17 +03:00
committed by Space
parent cc41592969
commit 24642a7c9f
3 changed files with 12 additions and 9 deletions
@@ -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
}
}