mirror of
https://github.com/microsoft/pyright.git
synced 2024-10-10 14:59:42 +03:00
Fixed regression that results in the incorrect type evaluation for the value
attribute of a StrEnum
or IntEnum
class. This addresses #7983.
This commit is contained in:
parent
bfc60526a0
commit
aed4c75980
@ -587,9 +587,10 @@ export function getTypeOfEnumMember(
|
||||
|
||||
if (memberName === 'value' || memberName === '_value_') {
|
||||
// Does the class explicitly override this member? Or it it using the
|
||||
// standard behavior provided by the "Enum" class?
|
||||
// standard behavior provided by the "Enum" class and other built-in
|
||||
// subclasses like "StrEnum" and "IntEnum"?
|
||||
const memberInfo = lookUpClassMember(classType, memberName);
|
||||
if (memberInfo && isClass(memberInfo.classType) && !ClassType.isBuiltIn(memberInfo.classType, 'Enum')) {
|
||||
if (memberInfo && isClass(memberInfo.classType) && !ClassType.isBuiltIn(memberInfo.classType)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ reveal_type(te15_A.value, expected_text="str")
|
||||
reveal_type(te15_A._value_, expected_text="str")
|
||||
|
||||
|
||||
class TestEnum16(Enum):
|
||||
class TestEnum16(IntEnum):
|
||||
A = 1
|
||||
B = 2
|
||||
C = 3
|
||||
|
Loading…
Reference in New Issue
Block a user