Skip to content

Commit

Permalink
Fixed a bug that led to a false positive when accessing a `cached_pro…
Browse files Browse the repository at this point in the history
…perty` defined on an enum. This addresses #5696.
  • Loading branch information
msfterictraut committed Aug 15, 2023
1 parent 88c3b75 commit 50a930a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/pyright-internal/src/analyzer/typeEvaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5729,10 +5729,16 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
];

if (usage.method === 'get') {
// Provide "objtype" argument.
// Provide "owner" argument.
// Use Any rather than None for the owner argument if accessing through an object.
// None is more correct, but it doesn't really matter, and many descriptor classes
// incorrectly annotate the owner parameter. Rather than create a bunch of noise,
// we'll use Any here.
argList.push({
argumentCategory: ArgumentCategory.Simple,
typeResult: { type: baseTypeClass },
typeResult: {
type: isAccessedThroughObject ? AnyType.create() : baseTypeClass,
},
});
} else if (usage.method === 'set') {
// Provide "value" argument.
Expand Down

0 comments on commit 50a930a

Please sign in to comment.