From 5b6d7868e776fce051578aa26ac401fafcee491e Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Thu, 2 Nov 2023 11:55:55 -0700 Subject: [PATCH] =?UTF-8?q?Fixed=20bug=20that=20led=20to=20an=20inconsiste?= =?UTF-8?q?ncy=20between=20the=20use=20of=20`type`=20and=20=E2=80=A6=20(#6?= =?UTF-8?q?253)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. --- packages/pyright-internal/src/analyzer/typeUtils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/pyright-internal/src/analyzer/typeUtils.ts b/packages/pyright-internal/src/analyzer/typeUtils.ts index 847c608c603f..7ec748539497 100644 --- a/packages/pyright-internal/src/analyzer/typeUtils.ts +++ b/packages/pyright-internal/src/analyzer/typeUtils.ts @@ -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]); + } } } }