mirror of
https://github.com/microsoft/pyright.git
synced 2024-09-11 07:55:56 +03:00
Fixed bug that leads to incorrect metatype for a class object that is created by calling the metaclass with a two-argument form.
This commit is contained in:
parent
d33a1051dd
commit
e5c0b59c77
@ -12958,7 +12958,7 @@ export function createTypeEvaluator(
|
||||
fileInfo.fileUri,
|
||||
ClassTypeFlags.ValidTypeAliasClass,
|
||||
ParseTreeUtils.getTypeSourceId(errorNode),
|
||||
/* declaredMetaclass */ undefined,
|
||||
metaclass,
|
||||
arg1Type.details.effectiveMetaclass
|
||||
);
|
||||
arg1Type.tupleTypeArguments.forEach((typeArg) => {
|
||||
|
@ -7,12 +7,10 @@ X1 = type("X1", (object,), {})
|
||||
X2 = type("X2", (object,), {})
|
||||
|
||||
|
||||
class A(X1):
|
||||
...
|
||||
class A(X1): ...
|
||||
|
||||
|
||||
class B(X2, A):
|
||||
...
|
||||
class B(X2, A): ...
|
||||
|
||||
|
||||
# This should generate an error because the first arg is not a string.
|
||||
@ -27,3 +25,11 @@ X5 = type("X5", (3,))
|
||||
|
||||
X6 = type("", tuple({str}), {})
|
||||
X7 = type("", (float, str), {})
|
||||
|
||||
|
||||
class Meta1(type): ...
|
||||
|
||||
|
||||
X8 = Meta1("X8", (list,), {})
|
||||
reveal_type(X8, expected_text="type[X8]")
|
||||
reveal_type(type(X8), expected_text="type[Meta1]")
|
||||
|
Loading…
Reference in New Issue
Block a user