10000 Fixed bug that resulted in incorrect type evaluation when bidirection… · codean-io/scip-python@6ad84ae · GitHub
[go: up one dir, main page]

Skip to content

Commit 6ad84ae

Browse files
committed
Fixed bug that resulted in incorrect type evaluation when bidirectional type inference was used along with a type alias that was involved in a circular declaration.
1 parent 170bfa0 commit 6ad84ae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/pyright-internal/src/analyzer/constraintSolver.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import {
5454
mapSubtypes,
5555
specializeTupleClass,
5656
transformExpectedTypeForConstructor,
57+
transformPossibleRecursiveTypeAlias,
5758
} from './typeUtils';
5859
import { TypeVarContext } from './typeVarContext';
5960

@@ -868,7 +869,9 @@ export function populateTypeVarContextBasedOnExpectedType(
868869
const targetTypeVar =
869870
ClassType.getTypeParameters(specializedType)[synthTypeVar.details.synthesizedIndex];
870871
if (index < expectedTypeArgs.length) {
871-
let expectedTypeArgValue: Type | undefined = expectedTypeArgs[index];
872+
let expectedTypeArgValue: Type | undefined = transformPossibleRecursiveTypeAlias(
873+
expectedTypeArgs[index]
874+
);
872875

873876
if (liveTypeVarScopes) {
874877
expectedTypeArgValue = transformExpectedTypeForConstructor(

0 commit comments

Comments
 (0)
0