Introduce Type Alias: Support type constructor extraction

This commit is contained in:
Alexey Sedunov
2016-07-19 18:18:24 +03:00
parent b5828a5fa1
commit 0769d47f4b
8 changed files with 85 additions and 22 deletions
@@ -466,4 +466,9 @@ fun KtElement.containingClass(): KtClass? = getStrictParentOfType<KtClass>()
fun KtClassOrObject.findPropertyByName(name: String): KtNamedDeclaration? {
return declarations.firstOrNull { it is KtProperty && it.name == name } as KtNamedDeclaration?
?: getPrimaryConstructorParameters().firstOrNull { it.hasValOrVar() && it.name == name }
}
fun isTypeConstructorReference(e: PsiElement): Boolean {
val parent = e.parent
return parent is KtUserType && parent.referenceExpression == e
}