Skip to content

Commit

Permalink
Changed the evaluated type of an in or not in operator to be `boo…
Browse files Browse the repository at this point in the history
…l` if the LHS doesn't support containment. Previously, the expression evaluated to `Never`. This addresses #9327.
  • Loading branch information
erictraut committed Oct 25, 2024
1 parent 662ebf5 commit bbdfde8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/pyright-internal/src/analyzer/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ function validateContainmentOperation(
deprecatedInfo = returnTypeResult.magicMethodDeprecationInfo;
}

return returnTypeResult?.type;
return returnTypeResult?.type ?? evaluator.getBuiltInObject(errorNode, 'bool');
}
);
}
Expand Down

0 comments on commit bbdfde8

Please sign in to comment.