Basic support of partially specified type arguments though a new underscore operator for type arguments

^KT-13394
This commit is contained in:
Victor Petukhov
2021-10-21 14:23:25 +03:00
parent e057831f7f
commit b69fb6779f
35 changed files with 1212 additions and 9 deletions
@@ -59,6 +59,9 @@ class KtNameReferenceExpression : KtExpressionImplStub<KotlinNameReferenceExpres
return visitor.visitSimpleNameExpression(this, data)
}
val isPlaceholder: Boolean
get() = getIdentifier()?.text?.equals("_") == true
companion object {
private val NAME_REFERENCE_EXPRESSIONS = TokenSet.create(IDENTIFIER, THIS_KEYWORD, SUPER_KEYWORD)
}
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.psi
import com.intellij.lang.ASTNode
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.psiUtil.collectAnnotationEntriesFromStubOrPsi
import org.jetbrains.kotlin.psi.psiUtil.findDescendantOfType
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes
@@ -38,6 +38,9 @@ class KtTypeReference : KtModifierListOwnerStub<KotlinPlaceHolderStub<KtTypeRefe
return visitor.visitTypeReference(this, data)
}
val isPlaceholder: Boolean
get() = findDescendantOfType<KtNameReferenceExpression>()?.isPlaceholder == true
val typeElement: KtTypeElement?
get() = KtStubbedPsiUtil.getStubOrPsiChild(this, KtStubElementTypes.TYPE_ELEMENT_TYPES, KtTypeElement.ARRAY_FACTORY)