mirror of
https://github.com/microsoft/pyright.git
synced 2024-10-07 13:29:17 +03:00
Changed type evaluator to elide NoReturn
from union generated from or
or and
operator.
This commit is contained in:
parent
c70cee87ea
commit
4685207d28
@ -9680,7 +9680,9 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
|
|||||||
(rightSubtypeExpanded, rightSubtypeUnexpanded) => {
|
(rightSubtypeExpanded, rightSubtypeUnexpanded) => {
|
||||||
// If the operator is an AND or OR, we need to combine the two types.
|
// If the operator is an AND or OR, we need to combine the two types.
|
||||||
if (operator === OperatorType.And || operator === OperatorType.Or) {
|
if (operator === OperatorType.And || operator === OperatorType.Or) {
|
||||||
return combineTypes([leftSubtypeUnexpanded, rightSubtypeUnexpanded]);
|
return removeNoReturnFromUnion(
|
||||||
|
combineTypes([leftSubtypeUnexpanded, rightSubtypeUnexpanded])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// The other boolean operators always return a bool value.
|
// The other boolean operators always return a bool value.
|
||||||
return getBuiltInObject(errorNode, 'bool');
|
return getBuiltInObject(errorNode, 'bool');
|
||||||
|
Loading…
Reference in New Issue
Block a user