Skip to content

Commit

Permalink
Fixed bug that led to incorrect return type inference for a generator…
Browse files Browse the repository at this point in the history
… that always raises an exception rather than returning. This addresses #6707. (#6708)
  • Loading branch information
erictraut authored Dec 11, 2023
1 parent 699eef8 commit c21f706
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/pyright-internal/src/analyzer/typeEvaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18040,11 +18040,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
// in the common case.
const sendType = isYieldResultUsed ? UnknownType.create() : AnyType.create();

typeArgs.push(
inferredYieldType,
sendType,
isNever(inferredReturnType) ? getNoneType() : inferredReturnType
);
typeArgs.push(inferredYieldType, sendType, inferredReturnType);

if (useAwaitableGenerator) {
typeArgs.push(AnyType.create());
Expand Down

0 comments on commit c21f706

Please sign in to comment.