mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
PY-76149 Support descriptor types as annotations for dataclass fields
(cherry picked from commit 78a127e1a0083ece810ad996124ad6ea65887da2) GitOrigin-RevId: 0c33fe51f5f13116f773577056317c537cbc83ef
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4ad6f08f45
commit
c653a43cab
@@ -254,6 +254,12 @@ class PyDataclassTypeProvider : PyTypeProviderBase() {
|
||||
if (type is PyCollectionType && type.classQName == Dataclasses.DATACLASSES_INITVAR) {
|
||||
return type.elementTypes.firstOrNull()
|
||||
}
|
||||
if (type is PyClassLikeType) {
|
||||
val expectedConstructorArgumentTypeRef = PyDescriptorTypeUtil.getExpectedValueTypeForDunderSet(field, type, context)
|
||||
if (expectedConstructorArgumentTypeRef != null) {
|
||||
return Ref.deref(expectedConstructorArgumentTypeRef)
|
||||
}
|
||||
}
|
||||
|
||||
if (type == null && dataclassType.asPredefinedType == PyDataclassParameters.PredefinedType.ATTRS) {
|
||||
methodDecoratedAsAttributeDefault(cls, field.name)
|
||||
|
||||
Reference in New Issue
Block a user