Skip to content

Commit

Permalink
Fixed bug that led to an inconsistency between the use of type and … (
Browse files Browse the repository at this point in the history
#6253)

* Fixed bug that led to an inconsistency between the use of `type` and `Type` when applying `isinstance` type narrowing in some cases. This addresses #6252.

* Fixed a bug that led to a false positive when using an unpacked iterable as an argument in a call expression _after_ a keyword argument. This addresses #6247.
  • Loading branch information
erictraut authored Nov 2, 2023
1 parent 6f9445f commit 5b6d786
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/pyright-internal/src/analyzer/typeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,9 @@ export function convertToInstance(type: Type, includeSubclasses = true): Type {
}
} else {
if (subtype.typeArguments && subtype.typeArguments.length > 0) {
return convertToInstantiable(subtype.typeArguments[0]);
if (!isAnyOrUnknown(subtype.typeArguments[0])) {
return convertToInstantiable(subtype.typeArguments[0]);
}
}
}
}
Expand Down

0 comments on commit 5b6d786

Please sign in to comment.