Skip to content

Commit

Permalink
Modified logic to take into account Final variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
erictraut committed Apr 27, 2024
1 parent 1368974 commit 1622abb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/pyright-internal/src/analyzer/typeEvaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4648,12 +4648,13 @@ export function createTypeEvaluator(
return undefined;
}

// If the symbol is a variable in the global scope, it is not eligible
// because it could be modified by other modules.
// If the symbol is a non-final variable in the global scope, it is not
// eligible because it could be modified by other modules.
if (
!decls.every(
(decl) =>
decl.type !== DeclarationType.Variable ||
decl.isFinal ||
ScopeUtils.getScopeForNode(decl.node)?.type !== ScopeType.Module
)
) {
Expand Down

0 comments on commit 1622abb

Please sign in to comment.