diff --git a/conformance/results/mypy/aliases_typealiastype.toml b/conformance/results/mypy/aliases_typealiastype.toml index 078f9961..1a034e81 100644 --- a/conformance/results/mypy/aliases_typealiastype.toml +++ b/conformance/results/mypy/aliases_typealiastype.toml @@ -4,7 +4,6 @@ Incorrectly rejects some recursive type aliases using TypeAliasType. Incorrectly rejects the use of a class-scoped TypeVar in a TypeAliasType definition. """ output = """ -aliases_typealiastype.py:19: error: Cannot resolve name "GoodAlias4" (possible cyclic definition) [misc] aliases_typealiastype.py:20: error: Cannot resolve name "GoodAlias5" (possible cyclic definition) [misc] aliases_typealiastype.py:22: error: Cannot resolve name "GoodAlias5" (possible cyclic definition) [misc] aliases_typealiastype.py:27: error: Type variable "T" is not included in type_params [valid-type] @@ -17,7 +16,6 @@ aliases_typealiastype.py:46: error: Cannot resolve name "BadAlias4" (possible cy aliases_typealiastype.py:47: error: Invalid recursive alias: a union item of itself [misc] aliases_typealiastype.py:48: error: Cannot resolve name "BadAlias6" (possible cyclic definition) [misc] aliases_typealiastype.py:48: error: Cannot resolve name "BadAlias7" (possible cyclic definition) [misc] -aliases_typealiastype.py:48: error: Name "BadAlias7" is used before definition [used-before-def] aliases_typealiastype.py:49: error: Cannot resolve name "BadAlias7" (possible cyclic definition) [misc] aliases_typealiastype.py:52: error: Invalid type alias: expression is not a valid type [valid-type] aliases_typealiastype.py:53: error: Bracketed expression "[...]" is not valid as a type [valid-type] @@ -35,10 +33,10 @@ aliases_typealiastype.py:62: error: Invalid type: try using Literal[1] instead? aliases_typealiastype.py:63: error: Invalid type alias: expression is not a valid type [valid-type] aliases_typealiastype.py:63: error: Function "list" could always be true in boolean context [truthy-function] aliases_typealiastype.py:64: error: Invalid type alias: expression is not a valid type [valid-type] +aliases_typealiastype.py:66: error: Cannot resolve name "BadAlias21" (possible cyclic definition) [misc] """ conformance_automated = "Fail" errors_diff = """ -Line 19: Unexpected errors ['aliases_typealiastype.py:19: error: Cannot resolve name "GoodAlias4" (possible cyclic definition) [misc]'] Line 20: Unexpected errors ['aliases_typealiastype.py:20: error: Cannot resolve name "GoodAlias5" (possible cyclic definition) [misc]'] Line 22: Unexpected errors ['aliases_typealiastype.py:22: error: Cannot resolve name "GoodAlias5" (possible cyclic definition) [misc]'] Line 27: Unexpected errors ['aliases_typealiastype.py:27: error: Type variable "T" is not included in type_params [valid-type]'] diff --git a/conformance/results/pyre/aliases_typealiastype.toml b/conformance/results/pyre/aliases_typealiastype.toml index 29cd273f..ed9e9178 100644 --- a/conformance/results/pyre/aliases_typealiastype.toml +++ b/conformance/results/pyre/aliases_typealiastype.toml @@ -5,7 +5,7 @@ Support for TypeAliasType is not implemented. output = """ aliases_typealiastype.py:17:41 Undefined attribute [16]: `list` has no attribute `__getitem__`. aliases_typealiastype.py:22:13 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Tuple[typing.Any, Type[Variable[$synthetic_attribute_resolution_variable]]]` but got `Tuple[ParamSpec, TypeVar]`. -aliases_typealiastype.py:22:65 Undefined attribute [16]: `tuple` has no attribute `__getitem__`. +aliases_typealiastype.py:22:67 Undefined attribute [16]: `tuple` has no attribute `__getitem__`. aliases_typealiastype.py:32:6 Undefined attribute [16]: `TypeAliasType` has no attribute `other_attrib`. aliases_typealiastype.py:35:4 Undefined or invalid type [11]: Annotation `GoodAlias4` is not defined as a type. aliases_typealiastype.py:37:4 Undefined or invalid type [11]: Annotation `GoodAlias5` is not defined as a type. @@ -32,8 +32,9 @@ Line 61: Expected 1 errors Line 62: Expected 1 errors Line 63: Expected 1 errors Line 64: Expected 1 errors +Line 66: Expected 1 errors Line 17: Unexpected errors ['aliases_typealiastype.py:17:41 Undefined attribute [16]: `list` has no attribute `__getitem__`.'] -Line 22: Unexpected errors ['aliases_typealiastype.py:22:13 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Tuple[typing.Any, Type[Variable[$synthetic_attribute_resolution_variable]]]` but got `Tuple[ParamSpec, TypeVar]`.', 'aliases_typealiastype.py:22:65 Undefined attribute [16]: `tuple` has no attribute `__getitem__`.'] +Line 22: Unexpected errors ['aliases_typealiastype.py:22:13 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Tuple[typing.Any, Type[Variable[$synthetic_attribute_resolution_variable]]]` but got `Tuple[ParamSpec, TypeVar]`.', 'aliases_typealiastype.py:22:67 Undefined attribute [16]: `tuple` has no attribute `__getitem__`.'] Line 35: Unexpected errors ['aliases_typealiastype.py:35:4 Undefined or invalid type [11]: Annotation `GoodAlias4` is not defined as a type.'] Line 37: Unexpected errors ['aliases_typealiastype.py:37:4 Undefined or invalid type [11]: Annotation `GoodAlias5` is not defined as a type.'] """ diff --git a/conformance/results/pyre/overloads_definitions.toml b/conformance/results/pyre/overloads_definitions.toml index 9462c19c..ecbcade1 100644 --- a/conformance/results/pyre/overloads_definitions.toml +++ b/conformance/results/pyre/overloads_definitions.toml @@ -5,14 +5,10 @@ Does not allow an overload with no implementation in a Protocol or an abstract b Expects @final/@override on all overloads and implementation, instead of implementation only. """ errors_diff = """ -Lines 71, 73, 78, 81: Expected exactly one error (tag 'func5') Lines 135, 136, 137, 141, 142: Expected error (tag 'invalid_final_2') Lines 220, 221, 222, 225, 226: Expected error (tag 'override_impl') Line 40: Unexpected errors ['overloads_definitions.py:40:4 Missing overload implementation [42]: Overloaded function `MyProto.func3` must have an implementation.'] Line 49: Unexpected errors ['overloads_definitions.py:49:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.func4` must have an implementation.'] -Line 73: Unexpected errors ['overloads_definitions.py:73:4 Incompatible overload [43]: The implementation of `C.func5` does not accept all possible arguments of overload defined on line `73`.'] -Line 78: Unexpected errors ['overloads_definitions.py:78:4 Incompatible overload [43]: The implementation of `C.func5` does not accept all possible arguments of overload defined on line `78`.'] -Line 81: Unexpected errors ['overloads_definitions.py:81:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] Line 117: Unexpected errors ['overloads_definitions.py:117:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] Line 215: Unexpected errors ['overloads_definitions.py:215:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s).'] """ @@ -22,8 +18,6 @@ overloads_definitions.py:28:0 Missing overload implementation [42]: Overloaded f overloads_definitions.py:40:4 Missing overload implementation [42]: Overloaded function `MyProto.func3` must have an implementation. overloads_definitions.py:49:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.func4` must have an implementation. overloads_definitions.py:59:4 Missing overload implementation [42]: Overloaded function `MyAbstractBase.not_abstract` must have an implementation. -overloads_definitions.py:73:4 Incompatible overload [43]: The implementation of `C.func5` does not accept all possible arguments of overload defined on line `73`. -overloads_definitions.py:78:4 Incompatible overload [43]: The implementation of `C.func5` does not accept all possible arguments of overload defined on line `78`. overloads_definitions.py:81:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). overloads_definitions.py:90:4 Incompatible overload [43]: The implementation of `C.func6` does not accept all possible arguments of overload defined on line `90`. overloads_definitions.py:90:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). diff --git a/conformance/results/pyre/version.toml b/conformance/results/pyre/version.toml index e9c0c954..cd0a5eb7 100644 --- a/conformance/results/pyre/version.toml +++ b/conformance/results/pyre/version.toml @@ -1,2 +1,2 @@ version = "pyre 0.9.23" -test_duration = 9.0 +test_duration = 9.8 diff --git a/conformance/results/pyright/aliases_typealiastype.toml b/conformance/results/pyright/aliases_typealiastype.toml index 610c1a96..732bebde 100644 --- a/conformance/results/pyright/aliases_typealiastype.toml +++ b/conformance/results/pyright/aliases_typealiastype.toml @@ -1,4 +1,7 @@ -conformant = "Pass" +conformant = "Partial" +notes = """ +Incorrectly allows undefined self reference. +""" output = """ aliases_typealiastype.py:32:18 - error: Cannot access attribute "other_attrib" for class "TypeAliasType"   Attribute "other_attrib" is unknown (reportAttributeAccessIssue) @@ -29,6 +32,7 @@ aliases_typealiastype.py:62:42 - error: Expected class but received "Literal[1]" aliases_typealiastype.py:63:42 - error: Binary operator not allowed in type expression (reportInvalidTypeForm) aliases_typealiastype.py:64:42 - error: Type expressions cannot use format string literals (f-strings) (reportGeneralTypeIssues) """ -conformance_automated = "Pass" +conformance_automated = "Fail" errors_diff = """ +Line 66: Expected 1 errors """ diff --git a/conformance/results/pyright/generics_type_erasure.toml b/conformance/results/pyright/generics_type_erasure.toml index cbbc0d1c..0cddc487 100644 --- a/conformance/results/pyright/generics_type_erasure.toml +++ b/conformance/results/pyright/generics_type_erasure.toml @@ -1,4 +1,7 @@ -conformant = "Pass" +conformant = "Partial" +notes = """ +Missing error regarding `type(instance).generic_attribute`. +""" output = """ generics_type_erasure.py:38:16 - error: Argument of type "Literal['']" cannot be assigned to parameter "label" of type "int | None" in function "__init__"   Type "Literal['']" is not assignable to type "int | None" @@ -12,8 +15,8 @@ generics_type_erasure.py:42:11 - error: Access to generic instance variable thro generics_type_erasure.py:43:11 - error: Access to generic instance variable through class is ambiguous (reportGeneralTypeIssues) generics_type_erasure.py:44:6 - error: Access to generic instance variable through class is ambiguous (reportGeneralTypeIssues) generics_type_erasure.py:45:6 - error: Access to generic instance variable through class is ambiguous (reportGeneralTypeIssues) -generics_type_erasure.py:46:10 - error: Access to generic instance variable through class is ambiguous (reportGeneralTypeIssues) """ -conformance_automated = "Pass" +conformance_automated = "Fail" errors_diff = """ +Line 46: Expected 1 errors """ diff --git a/conformance/results/pyright/version.toml b/conformance/results/pyright/version.toml index 03b8b5c6..f105339d 100644 --- a/conformance/results/pyright/version.toml +++ b/conformance/results/pyright/version.toml @@ -1,2 +1,2 @@ -version = "pyright 1.1.399" +version = "pyright 1.1.400" test_duration = 1.1 diff --git a/conformance/results/pytype/aliases_typealiastype.toml b/conformance/results/pytype/aliases_typealiastype.toml index a9d4ad6b..da0105cf 100644 --- a/conformance/results/pytype/aliases_typealiastype.toml +++ b/conformance/results/pytype/aliases_typealiastype.toml @@ -18,40 +18,35 @@ aliases_typealiastype.py:16:14: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in GoodAlias1 = TypeAliasType("GoodAlias1", int) \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -aliases_typealiastype.py:19:51: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Name 'GoodAlias4' is not defined [name-error] +aliases_typealiastype.py:19:42: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : unsupported operand type(s) for |: 'T: TypeVar' and ''list[GoodAlias4[T]]': str' [unsupported-operands] -GoodAlias4 = TypeAliasType("GoodAlias4", T | list[GoodAlias4[T]], type_params=(T,)) - \u001b[1m\u001b[31m~~~~~~~~~~\u001b[39m\u001b[0m +GoodAlias4 = TypeAliasType("GoodAlias4", T | "list[GoodAlias4[T]]", type_params=(T,)) + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -aliases_typealiastype.py:22:40: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Name 'GoodAlias5' is not defined [name-error] +aliases_typealiastype.py:22:68: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] - Callable[P, TStr] | list[S] | list[GoodAlias5[S, TStr, P]] | tuple[*Ts], - \u001b[1m\u001b[31m~~~~~~~~~~\u001b[39m\u001b[0m + Callable[P, TStr] | list[S] | list["GoodAlias5[S, TStr, P]"] | tuple[*Ts], + \u001b[1m\u001b[31m~~~~~~~~~~\u001b[39m\u001b[0m -aliases_typealiastype.py:22:66: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] +aliases_typealiastype.py:22:35: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Invalid type annotation '' [invalid-annotation] - Callable[P, TStr] | list[S] | list[GoodAlias5[S, TStr, P]] | tuple[*Ts], - \u001b[1m\u001b[31m~~~~~~~~~~\u001b[39m\u001b[0m + Callable[P, TStr] | list[S] | list["GoodAlias5[S, TStr, P]"] | tuple[*Ts], + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m aliases_typealiastype.py:32:7: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : No attribute 'other_attrib' on TypeAliasType [attribute-error] print(GoodAlias1.other_attrib) # E: unknown attribute \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -aliases_typealiastype.py:46:40: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Name 'BadAlias4' is not defined [name-error] +aliases_typealiastype.py:47:40: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : unsupported operand type(s) for |: 'T: TypeVar' and ''BadAlias5[str]': str' [unsupported-operands] -BadAlias4 = TypeAliasType("BadAlias4", BadAlias4) # E: circular dependency - \u001b[1m\u001b[31m~~~~~~~~~\u001b[39m\u001b[0m +BadAlias5 = TypeAliasType("BadAlias5", T | "BadAlias5[str]", type_params=(T,)) # E: circular dependency + \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m -aliases_typealiastype.py:47:44: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Name 'BadAlias5' is not defined [name-error] +aliases_typealiastype.py:66:47: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Name 'BadAlias21' is not defined [name-error] -BadAlias5 = TypeAliasType("BadAlias5", T | BadAlias5[str], type_params=(T,)) # E: circular dependency - \u001b[1m\u001b[31m~~~~~~~~~\u001b[39m\u001b[0m - -aliases_typealiastype.py:48:40: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : Name 'BadAlias7' is not defined [name-error] - -BadAlias6 = TypeAliasType("BadAlias6", BadAlias7) # E: circular dependency - \u001b[1m\u001b[31m~~~~~~~~~\u001b[39m\u001b[0m +BadAlias21 = TypeAliasType("BadAlias21", list[BadAlias21]) # E + \u001b[1m\u001b[31m~~~~~~~~~~\u001b[39m\u001b[0m """ conformance_automated = "Fail" @@ -60,6 +55,8 @@ Line 40: Expected 1 errors Line 43: Expected 1 errors Line 44: Expected 1 errors Line 45: Expected 1 errors +Line 46: Expected 1 errors +Line 48: Expected 1 errors Line 52: Expected 1 errors Line 53: Expected 1 errors Line 54: Expected 1 errors @@ -76,6 +73,6 @@ Line 64: Expected 1 errors Line 5: Unexpected errors ['aliases_typealiastype.py:5:1: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : typing.TypeVarTuple not supported yet [not-supported-yet]'] Line 11: Unexpected errors ['aliases_typealiastype.py:11:6: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Function TypeVarTuple.__init__ expects 1 arg(s), got 2 [wrong-arg-count]'] Line 16: Unexpected errors ["aliases_typealiastype.py:16:14: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] -Line 19: Unexpected errors ["aliases_typealiastype.py:19:51: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Name 'GoodAlias4' is not defined [name-error]"] -Line 22: Unexpected errors ["aliases_typealiastype.py:22:40: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Name 'GoodAlias5' is not defined [name-error]", "aliases_typealiastype.py:22:66: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] +Line 19: Unexpected errors ["aliases_typealiastype.py:19:42: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : unsupported operand type(s) for |: 'T: TypeVar' and ''list[GoodAlias4[T]]': str' [unsupported-operands]"] +Line 22: Unexpected errors ["aliases_typealiastype.py:22:68: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]", "aliases_typealiastype.py:22:35: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in : Invalid type annotation '' [invalid-annotation]"] """ diff --git a/conformance/results/pytype/overloads_definitions.toml b/conformance/results/pytype/overloads_definitions.toml index 5716f0e5..01f5bab9 100644 --- a/conformance/results/pytype/overloads_definitions.toml +++ b/conformance/results/pytype/overloads_definitions.toml @@ -185,8 +185,8 @@ class Child(Base): # E[override-final] \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m \u001b[1m\u001b[31m\u001b[39m\u001b[0m - @override -\u001b[1m\u001b[31m~~~~~~~~~~~~~\u001b[39m\u001b[0m + @override # E[bad_override] +\u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m def bad_override(self, x: int | str) -> int | str: # E[bad_override] \u001b[1m\u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[39m\u001b[0m ... diff --git a/conformance/results/pytype/overloads_definitions_stub.toml b/conformance/results/pytype/overloads_definitions_stub.toml index bf139932..24d83050 100644 --- a/conformance/results/pytype/overloads_definitions_stub.toml +++ b/conformance/results/pytype/overloads_definitions_stub.toml @@ -10,7 +10,7 @@ Lines 39, 41, 44: Expected error (tag 'func6') Lines 67, 69, 71, 73: Expected error (tag 'invalid_final') Lines 80, 82, 84, 86: Expected error (tag 'invalid_final_2') Lines 102, 107, 108, 111, 113: Expected error (tag 'override-final') -Lines 120, 122: Expected error (tag 'bad_override') +Lines 120, 121, 122: Expected error (tag 'bad_override') Lines 143, 147, 149: Expected error (tag 'override_impl') """ output = """ diff --git a/conformance/results/pytype/specialtypes_never.toml b/conformance/results/pytype/specialtypes_never.toml index be27a72a..7a231858 100644 --- a/conformance/results/pytype/specialtypes_never.toml +++ b/conformance/results/pytype/specialtypes_never.toml @@ -8,10 +8,11 @@ specialtypes_never.py:11:8: \u001b[1m\u001b[31merror\u001b[39m\u001b[0m: in : argument "covariant" to TypeVar not supported yet [not-supported-yet]'] -Line 21: Unexpected errors ['specialtypes_never.py:21:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func1: bad return type [bad-return-type]'] +Line 21: Unexpected errors ['specialtypes_never.py:21:8: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func1: bad return type [bad-return-type]'] Line 68: Unexpected errors ['specialtypes_never.py:68:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func6: Type annotation for v1 does not match type of assignment [annotation-type-mismatch]'] Line 69: Unexpected errors ['specialtypes_never.py:69:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func6: Type annotation for v2 does not match type of assignment [annotation-type-mismatch]'] Line 70: Unexpected errors ['specialtypes_never.py:70:5: \\x1b[1m\\x1b[31merror\\x1b[39m\\x1b[0m: in func6: Type annotation for v3 does not match type of assignment [annotation-type-mismatch]'] diff --git a/conformance/results/pytype/version.toml b/conformance/results/pytype/version.toml index 3a84f443..22d96d6b 100644 --- a/conformance/results/pytype/version.toml +++ b/conformance/results/pytype/version.toml @@ -1,2 +1,2 @@ version = "pytype 2024.10.11" -test_duration = 31.3 +test_duration = 33.6 diff --git a/conformance/results/results.html b/conformance/results/results.html index dc93d81f..c36fa49a 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -161,14 +161,14 @@

Python Type System Conformance Test Results

mypy 1.15.0
1.8sec
-
pyright 1.1.399
+
pyright 1.1.400
1.1sec
pyre 0.9.23
-
9.0sec
+
9.8sec
pytype 2024.10.11
-
31.3sec
+
33.6sec
@@ -356,7 +356,7 @@

Python Type System Conformance Test Results

     generics_type_erasure
Partial

Infers Node[Never] instead of Node[Any] when argument is not provided.

False negative on instance attribute access on type(node).

-Pass +
Partial

no error for `type(n1).label`

Partial

Does not erase unspecified type variables to `Any` prior to `assert_type` handling.

False negatives on instance attribute access on the type.

Does not infer type of `DefaultDict` with explicit type parameters on constructor.

False negatives on assert_type uses.

Unsupported @@ -491,7 +491,7 @@

Python Type System Conformance Test Results

     aliases_typealiastype
Partial

Incorrectly rejects some recursive type aliases using TypeAliasType.

Incorrectly rejects the use of a class-scoped TypeVar in a TypeAliasType definition.

-Pass +
Partial

incorrectly allows undefined self reference

Unsupported

Support for TypeAliasType is not implemented.

Unsupported

Support for TypeAliasType is not implemented.

diff --git a/conformance/tests/aliases_typealiastype.py b/conformance/tests/aliases_typealiastype.py index 644809d1..d696bfde 100644 --- a/conformance/tests/aliases_typealiastype.py +++ b/conformance/tests/aliases_typealiastype.py @@ -16,10 +16,10 @@ GoodAlias1 = TypeAliasType("GoodAlias1", int) GoodAlias2 = TypeAliasType("GoodAlias2", list[T], type_params=(T,)) GoodAlias3 = TypeAliasType("GoodAlias3", list[T] | list[S], type_params=(S, T)) -GoodAlias4 = TypeAliasType("GoodAlias4", T | list[GoodAlias4[T]], type_params=(T,)) +GoodAlias4 = TypeAliasType("GoodAlias4", T | "list[GoodAlias4[T]]", type_params=(T,)) GoodAlias5 = TypeAliasType( "GoodAlias5", - Callable[P, TStr] | list[S] | list[GoodAlias5[S, TStr, P]] | tuple[*Ts], + Callable[P, TStr] | list[S] | list["GoodAlias5[S, TStr, P]"] | tuple[*Ts], type_params=(S, TStr, P, Ts), ) @@ -43,9 +43,9 @@ class ClassA(Generic[T]): BadAlias1 = TypeAliasType("BadAlias1", list[S], type_params=(T,)) # E: S not in scope BadAlias2 = TypeAliasType("BadAlias2", list[S]) # E: S not in scope BadAlias3 = TypeAliasType("BadAlias3", int, type_params=my_tuple) # E: not literal tuple -BadAlias4 = TypeAliasType("BadAlias4", BadAlias4) # E: circular dependency -BadAlias5 = TypeAliasType("BadAlias5", T | BadAlias5[str], type_params=(T,)) # E: circular dependency -BadAlias6 = TypeAliasType("BadAlias6", BadAlias7) # E: circular dependency +BadAlias4 = TypeAliasType("BadAlias4", "BadAlias4") # E: circular dependency +BadAlias5 = TypeAliasType("BadAlias5", T | "BadAlias5[str]", type_params=(T,)) # E: circular dependency +BadAlias6 = TypeAliasType("BadAlias6", "BadAlias7") # E: circular dependency BadAlias7 = TypeAliasType("BadAlias7", BadAlias6) # E?: circular dependency # The following are invalid type expressions for a type alias. @@ -62,3 +62,5 @@ class ClassA(Generic[T]): BadAlias18 = TypeAliasType("BadAlias18", 1) # E BadAlias19 = TypeAliasType("BadAlias19", list or set) # E BadAlias20 = TypeAliasType("BadAlias20", f"{'int'}") # E + +BadAlias21 = TypeAliasType("BadAlias21", list[BadAlias21]) # E