mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
refactor pycharm: Remove mainElement property from PyTypeMember. element should be used instead
GitOrigin-RevId: e9dce24833d0770d44926d51b7eae03b8975ebe7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7775817184
commit
ae31c8397d
@@ -16,7 +16,7 @@ import org.jetbrains.annotations.ApiStatus
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
class PyTypeMember @JvmOverloads @ApiStatus.Internal constructor(
|
||||
val mainElement: PsiElement?,
|
||||
mainElement: PsiElement?,
|
||||
val type: PyType?,
|
||||
val isClassVar: Boolean = false,
|
||||
val getter: PsiElement? = mainElement,
|
||||
@@ -35,7 +35,11 @@ class PyTypeMember @JvmOverloads @ApiStatus.Internal constructor(
|
||||
val isWritable: Boolean get() = setter != null
|
||||
val isDeletable: Boolean get() = deleter != null
|
||||
|
||||
val name: String? get() = if (mainElement is PsiNamedElement) mainElement.name else null
|
||||
val name: String?
|
||||
get() {
|
||||
val e = element
|
||||
return if (e is PsiNamedElement) e.name else null
|
||||
}
|
||||
|
||||
private companion object {
|
||||
fun getSetterFromMainElement(element: PsiElement?): PsiElement? {
|
||||
|
||||
@@ -36,7 +36,7 @@ fun inspectProtocolSubclass(protocol: PyClassType, subclass: PyClassType, contex
|
||||
protocolMembers.addAll(superClassesMembers)
|
||||
|
||||
for (protocolMember in protocolMembers) {
|
||||
val protocolElement = protocolMember.mainElement ?: continue
|
||||
val protocolElement = protocolMember.element ?: continue
|
||||
if (protocolElement is PyPossibleClassMember) {
|
||||
val cls = protocolElement.containingClass
|
||||
if (cls != null && !isProtocol(cls, context)) {
|
||||
|
||||
@@ -131,9 +131,9 @@ class PyProtocolInspection : PyInspection() {
|
||||
) {
|
||||
subclassMembers
|
||||
.asSequence()
|
||||
.filter { it.mainElement?.containingFile == type.pyClass.containingFile }
|
||||
.filter { it.element?.containingFile == type.pyClass.containingFile }
|
||||
.forEach {
|
||||
val element = it.mainElement
|
||||
val element = it.element
|
||||
val place = if (element is PsiNameIdentifierOwner) element.nameIdentifier else element ?: return@forEach
|
||||
val elementName = if (element is PsiNameIdentifierOwner) element.name else return@forEach
|
||||
|
||||
|
||||
@@ -686,7 +686,7 @@ public final class PyTypeChecker {
|
||||
|
||||
GenericSubstitutions substitutions = collectTypeSubstitutions(expectedProtocol, matchContext.context);
|
||||
for (kotlin.Pair<PyTypeMember, List<PyTypeMember>> pair : protocolElements) {
|
||||
PsiElement pm = pair.getFirst().getMainElement();
|
||||
PsiElement pm = pair.getFirst().getElement();
|
||||
if (!(pm instanceof PsiNamedElement protocolMember)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user