Skip to content

Commit eed0815

Browse files
committed
Merge branch 'main' into overloads
* main: (29 commits) Updated conformance test results for the latest versions of type chec… (#1904) Add content from typeshed/CONTRIBUTING.md (#1882) Fix markup in generics specification (#1900) Specs clarification: Forbid `ClassVar` and `Final` within `TypedDict` body (#1890) Remove paragraph mentioning minor edits through the mailing list (#1891) Writing Stubs: Add "Overloads and Flags" section (#1894) Fix a typo (#1893) Update conformance tests for recent generics spec change (#1892) Clarify some behavior around user-defined generic classes (#1879) Modernizing guide: Mention TypeGuard/TypeIs (#1887) Tools can perform "some" refactorings (#1886) Mention use of cast in enum type stub example (#1877) Update conformance results after new pyre release (#1878) Add a label for typed dictionaries class-based syntax (#1873) Add missing return type to generic_syntax_infer_variance.py (#1871) Updated conformance results for mypy 1.13 and pyright 1.1.386 (#1870) Modernizing guide: also mention `com2ann` (#1869) Suggest `pyupgrade` or `ruff` for modernizing superseded typing features (#1868) Updated conformance results for pyright 1.1.385. (#1867) Updated conformance results for mypy 1.12. (#1866) ...
2 parents e13dbbe + e523717 commit eed0815

File tree

342 files changed

+9966
-4540
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

342 files changed

+9966
-4540
lines changed

conformance/results/mypy/aliases_explicit.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ aliases_explicit.py:79: error: Invalid type alias: expression is not a valid typ
1212
aliases_explicit.py:80: error: Bracketed expression "[...]" is not valid as a type [valid-type]
1313
aliases_explicit.py:81: error: Invalid type alias: expression is not a valid type [valid-type]
1414
aliases_explicit.py:82: error: Invalid type alias: expression is not a valid type [valid-type]
15-
aliases_explicit.py:83: error: Invalid type alias: expression is not a valid type [valid-type]
15+
aliases_explicit.py:83: error: Inline TypedDict is experimental, must be enabled with --enable-incomplete-feature=InlineTypedDict [misc]
16+
aliases_explicit.py:83: error: Name "b" is not defined [name-defined]
1617
aliases_explicit.py:84: error: Invalid type alias: expression is not a valid type [valid-type]
1718
aliases_explicit.py:85: error: Invalid type alias: expression is not a valid type [valid-type]
1819
aliases_explicit.py:86: error: Invalid type alias: expression is not a valid type [valid-type]
Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
conformant = "Partial"
22
notes = """
3-
Does not reject use of TypeAliasType as base class.
4-
Does not reject redefinition of type alias defined with type statement.
53
Does not reject type alias defined in function scope.
6-
Does not reject type alias with circular definition.
74
"""
85
output = """
96
aliases_type_statement.py:17: error: "TypeAliasType" has no attribute "bit_count" [attr-defined]
107
aliases_type_statement.py:19: error: "TypeAliasType" not callable [operator]
118
aliases_type_statement.py:23: error: "TypeAliasType" has no attribute "other_attrib" [attr-defined]
9+
aliases_type_statement.py:26: error: Type alias defined using "type" statement not valid as base class [misc]
1210
aliases_type_statement.py:31: error: Parameterized generics cannot be used with class or instance checks [misc]
1311
aliases_type_statement.py:31: error: Argument 2 to "isinstance" has incompatible type "TypeAliasType"; expected "_ClassInfo" [arg-type]
1412
aliases_type_statement.py:37: error: Invalid type alias: expression is not a valid type [valid-type]
1513
aliases_type_statement.py:38: error: Bracketed expression "[...]" is not valid as a type [valid-type]
1614
aliases_type_statement.py:39: error: Invalid type alias: expression is not a valid type [valid-type]
1715
aliases_type_statement.py:40: error: Invalid type alias: expression is not a valid type [valid-type]
18-
aliases_type_statement.py:41: error: Invalid type alias: expression is not a valid type [valid-type]
16+
aliases_type_statement.py:41: error: Inline TypedDict is experimental, must be enabled with --enable-incomplete-feature=InlineTypedDict [misc]
17+
aliases_type_statement.py:41: error: Name "b" is not defined [name-defined]
1918
aliases_type_statement.py:42: error: Invalid type alias: expression is not a valid type [valid-type]
2019
aliases_type_statement.py:43: error: Invalid type alias: expression is not a valid type [valid-type]
2120
aliases_type_statement.py:44: error: Invalid type alias: expression is not a valid type [valid-type]
@@ -25,22 +24,18 @@ aliases_type_statement.py:46: error: Invalid type: try using Literal[True] inste
2524
aliases_type_statement.py:47: error: Invalid type: try using Literal[1] instead? [valid-type]
2625
aliases_type_statement.py:48: error: Invalid type alias: expression is not a valid type [valid-type]
2726
aliases_type_statement.py:49: error: Invalid type alias: expression is not a valid type [valid-type]
28-
aliases_type_statement.py:54: error: Name "BadTypeAlias14" already defined on line 52 [no-redef]
29-
aliases_type_statement.py:64: error: All type parameters should be declared ("V" not declared) [valid-type]
30-
aliases_type_statement.py:69: error: All type parameters should be declared ("T1" not declared) [valid-type]
31-
aliases_type_statement.py:79: error: Type argument "str" of "RecursiveTypeAlias2" must be a subtype of "int" [type-var]
32-
aliases_type_statement.py:81: error: Type argument "int" of "RecursiveTypeAlias2" must be a subtype of "str" [type-var]
33-
aliases_type_statement.py:84: error: Cannot resolve name "RecursiveTypeAlias3" (possible cyclic definition) [misc]
34-
aliases_type_statement.py:86: error: Invalid recursive alias: a union item of itself [misc]
35-
aliases_type_statement.py:90: error: Cannot resolve name "RecursiveTypeAlias6" (possible cyclic definition) [misc]
36-
aliases_type_statement.py:90: error: Cannot resolve name "RecursiveTypeAlias7" (possible cyclic definition) [misc]
37-
aliases_type_statement.py:91: error: Cannot resolve name "RecursiveTypeAlias7" (possible cyclic definition) [misc]
27+
aliases_type_statement.py:52: error: Name "BadTypeAlias14" already defined on line 51 [no-redef]
28+
aliases_type_statement.py:62: error: All type parameters should be declared ("V" not declared) [valid-type]
29+
aliases_type_statement.py:67: error: All type parameters should be declared ("T1" not declared) [valid-type]
30+
aliases_type_statement.py:77: error: Type argument "str" of "RecursiveTypeAlias2" must be a subtype of "int" [type-var]
31+
aliases_type_statement.py:79: error: Type argument "int" of "RecursiveTypeAlias2" must be a subtype of "str" [type-var]
32+
aliases_type_statement.py:82: error: Cannot resolve name "RecursiveTypeAlias3" (possible cyclic definition) [misc]
33+
aliases_type_statement.py:84: error: Invalid recursive alias: a union item of itself [misc]
34+
aliases_type_statement.py:88: error: Cannot resolve name "RecursiveTypeAlias6" (possible cyclic definition) [misc]
35+
aliases_type_statement.py:88: error: Cannot resolve name "RecursiveTypeAlias7" (possible cyclic definition) [misc]
36+
aliases_type_statement.py:89: error: Cannot resolve name "RecursiveTypeAlias7" (possible cyclic definition) [misc]
3837
"""
3938
conformance_automated = "Fail"
4039
errors_diff = """
41-
Line 26: Expected 1 errors
42-
Line 52: Expected 1 errors
43-
Line 58: Expected 1 errors
44-
Line 54: Unexpected errors ['aliases_type_statement.py:54: error: Name "BadTypeAlias14" already defined on line 52 [no-redef]']
45-
Line 91: Unexpected errors ['aliases_type_statement.py:91: error: Cannot resolve name "RecursiveTypeAlias7" (possible cyclic definition) [misc]']
40+
Line 56: Expected 1 errors
4641
"""

conformance/results/mypy/aliases_typealiastype.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ aliases_typealiastype.py:52: error: Invalid type alias: expression is not a vali
2323
aliases_typealiastype.py:53: error: Bracketed expression "[...]" is not valid as a type [valid-type]
2424
aliases_typealiastype.py:54: error: Invalid type alias: expression is not a valid type [valid-type]
2525
aliases_typealiastype.py:55: error: Invalid type alias: expression is not a valid type [valid-type]
26-
aliases_typealiastype.py:56: error: Invalid type alias: expression is not a valid type [valid-type]
26+
aliases_typealiastype.py:56: error: Inline TypedDict is experimental, must be enabled with --enable-incomplete-feature=InlineTypedDict [misc]
27+
aliases_typealiastype.py:56: error: Name "b" is not defined [name-defined]
2728
aliases_typealiastype.py:57: error: Invalid type alias: expression is not a valid type [valid-type]
2829
aliases_typealiastype.py:58: error: Invalid type alias: expression is not a valid type [valid-type]
2930
aliases_typealiastype.py:59: error: Invalid type alias: expression is not a valid type [valid-type]

conformance/results/mypy/annotations_forward_refs.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@ Incorrectly generates error for quoted type defined in class scope.
66
"""
77
output = """
88
annotations_forward_refs.py:41: error: Invalid type comment or annotation [valid-type]
9-
annotations_forward_refs.py:42: error: Bracketed expression "[...]" is not valid as a type [valid-type]
10-
annotations_forward_refs.py:43: error: Syntax error in type annotation [syntax]
11-
annotations_forward_refs.py:43: note: Suggestion: Use Tuple[T1, ..., Tn] instead of (T1, ..., Tn)
9+
annotations_forward_refs.py:42: error: Invalid type comment or annotation [valid-type]
10+
annotations_forward_refs.py:43: error: Invalid type comment or annotation [valid-type]
1211
annotations_forward_refs.py:44: error: Invalid type comment or annotation [valid-type]
1312
annotations_forward_refs.py:45: error: Invalid type comment or annotation [valid-type]
1413
annotations_forward_refs.py:46: error: Invalid type comment or annotation [valid-type]
1514
annotations_forward_refs.py:47: error: Invalid type comment or annotation [valid-type]
1615
annotations_forward_refs.py:48: error: Invalid type comment or annotation [valid-type]
1716
annotations_forward_refs.py:49: error: Variable "annotations_forward_refs.var1" is not valid as a type [valid-type]
1817
annotations_forward_refs.py:49: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
19-
annotations_forward_refs.py:50: error: Invalid type: try using Literal[True] instead? [valid-type]
20-
annotations_forward_refs.py:51: error: Invalid type: try using Literal[1] instead? [valid-type]
21-
annotations_forward_refs.py:52: error: Invalid type: try using Literal[-1] instead? [valid-type]
18+
annotations_forward_refs.py:50: error: Invalid type comment or annotation [valid-type]
19+
annotations_forward_refs.py:51: error: Invalid type comment or annotation [valid-type]
20+
annotations_forward_refs.py:52: error: Invalid type comment or annotation [valid-type]
2221
annotations_forward_refs.py:53: error: Invalid type comment or annotation [valid-type]
2322
annotations_forward_refs.py:54: error: Invalid type comment or annotation [valid-type]
2423
annotations_forward_refs.py:55: error: Module "types" is not valid as a type [valid-type]
Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
conformant = "Unsupported"
2-
notes = """
3-
Does not support @deprecated.
4-
"""
5-
conformance_automated = "Fail"
1+
conformant = "Pass"
2+
conformance_automated = "Pass"
63
errors_diff = """
7-
Line 18: Expected 1 errors
8-
Line 24: Expected 1 errors
9-
Line 25: Expected 1 errors
10-
Line 30: Expected 1 errors
11-
Line 41: Expected 1 errors
12-
Line 42: Expected 1 errors
13-
Line 44: Expected 1 errors
14-
Line 47: Expected 1 errors
15-
Line 48: Expected 1 errors
16-
Line 58: Expected 1 errors
17-
Line 69: Expected 1 errors
18-
Line 98: Expected 1 errors
194
"""
205
output = """
6+
directives_deprecated.py:18: error: class _directives_deprecated_library.Ham is deprecated: Use Spam instead [deprecated]
7+
directives_deprecated.py:24: error: function _directives_deprecated_library.norwegian_blue is deprecated: It is pining for the fjords [deprecated]
8+
directives_deprecated.py:25: error: function _directives_deprecated_library.norwegian_blue is deprecated: It is pining for the fjords [deprecated]
9+
directives_deprecated.py:30: error: overload def (x: builtins.int) -> builtins.str of function _directives_deprecated_library.foo is deprecated: Only str will be allowed [deprecated]
10+
directives_deprecated.py:41: error: function _directives_deprecated_library.Spam.__add__ is deprecated: There is enough spam in the world [deprecated]
11+
directives_deprecated.py:42: error: function _directives_deprecated_library.Spam.__add__ is deprecated: There is enough spam in the world [deprecated]
12+
directives_deprecated.py:44: error: function _directives_deprecated_library.Spam.greasy is deprecated: All spam will be equally greasy [deprecated]
13+
directives_deprecated.py:47: error: function _directives_deprecated_library.Spam.shape is deprecated: Shapes are becoming immutable [deprecated]
14+
directives_deprecated.py:48: error: function _directives_deprecated_library.Spam.shape is deprecated: Shapes are becoming immutable [deprecated]
15+
directives_deprecated.py:58: error: function directives_deprecated.Invocable.__call__ is deprecated: Deprecated [deprecated]
16+
directives_deprecated.py:69: error: function directives_deprecated.lorem is deprecated: Deprecated [deprecated]
17+
directives_deprecated.py:98: error: function directives_deprecated.SupportsFoo1.foo is deprecated: Deprecated [deprecated]
2118
"""

conformance/results/mypy/enums_members.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
conformant = "Partial"
22
notes = """
33
Does not treat attribute with annotation and no assignment as non-member.
4-
Does not reject use of annotation with enum member.
54
Does not treat callables as non-members.
65
Does not honor `enum.member` as method decorator.
76
Does not properly handle aliased enum members.
@@ -10,7 +9,6 @@ Does not treat attributes with private names as non-members.
109
"""
1110
conformance_automated = "Fail"
1211
errors_diff = """
13-
Line 50: Expected 1 errors
1412
Line 82: Expected 1 errors
1513
Line 83: Expected 1 errors
1614
Line 129: Expected 1 errors
@@ -26,6 +24,8 @@ enums_members.py:27: error: Expression is of type "Literal[Pet.genus]", not "str
2624
enums_members.py:28: error: Expression is of type "Literal[Pet.species]", not "str" [assert-type]
2725
enums_members.py:35: error: Expression is of type "Literal[Pet2.genus]", not "str" [assert-type]
2826
enums_members.py:36: error: Expression is of type "Literal[Pet2.species]", not "str" [assert-type]
27+
enums_members.py:50: error: Enum members must be left unannotated [misc]
28+
enums_members.py:50: note: See https://typing.readthedocs.io/en/latest/spec/enums.html#defining-members
2929
enums_members.py:84: error: Expression is of type "Callable[[Pet4], str]", not "Any" [assert-type]
3030
enums_members.py:84: error: Parameter 1 of Literal[...] is invalid [valid-type]
3131
enums_members.py:85: error: Expression is of type "Callable[[Pet4], None]", not "Any" [assert-type]

conformance/results/mypy/generics_base_class.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
conformant = "Pass"
1+
conformant = "Partial"
2+
notes = """
3+
Does not detect inconsistent type variable ordering.
4+
"""
25
output = """
36
generics_base_class.py:26: error: Argument 1 to "takes_dict_incorrect" has incompatible type "SymbolTable"; expected "dict[str, list[object]]" [arg-type]
47
generics_base_class.py:29: error: Variable "typing.Generic" is not valid as a type [valid-type]
@@ -9,6 +12,7 @@ generics_base_class.py:49: error: "LinkedList" expects 1 type argument, but 2 gi
912
generics_base_class.py:61: error: "MyDict" expects 1 type argument, but 2 given [type-arg]
1013
generics_base_class.py:68: error: Duplicate type variables in Generic[...] or Protocol[...] [misc]
1114
"""
12-
conformance_automated = "Pass"
15+
conformance_automated = "Fail"
1316
errors_diff = """
17+
Line 98: Expected 1 errors
1418
"""
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
conformant = "Partial"
2-
notes = """
3-
Does not reject the use of a constraint parameterized by another type variable.
4-
"""
1+
conformant = "Pass"
52
output = """
63
generics_basic.py:40: error: Value of type variable "AnyStr" of "concat" cannot be "Sequence[object]" [type-var]
74
generics_basic.py:41: error: Value of type variable "AnyStr" of "concat" cannot be "Sequence[object]" [type-var]
85
generics_basic.py:49: error: Type variable must have at least two constrained types [misc]
6+
generics_basic.py:55: error: TypeVar constraint type cannot be parametrized by type variables [misc]
97
generics_basic.py:69: error: Value of type variable "AnyStr" of "concat" cannot be "Sequence[object]" [type-var]
108
generics_basic.py:121: error: Duplicate type variables in Generic[...] or Protocol[...] [misc]
119
generics_basic.py:157: error: Invalid index type "int" for "MyMap1[str, int]"; expected type "str" [index]
1210
generics_basic.py:158: error: Invalid index type "int" for "MyMap2[int, str]"; expected type "str" [index]
13-
generics_basic.py:191: error: Dynamic metaclass not supported for "GenericMetaInstance" [misc]
14-
generics_basic.py:191: error: Type variable "generics_basic.T" is unbound [valid-type]
15-
generics_basic.py:191: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
16-
generics_basic.py:191: note: (Hint: Use "T" in function signature to bind "T" inside a function)
11+
generics_basic.py:162: error: Free type variable expected in Generic[...] [misc]
12+
generics_basic.py:163: error: Free type variable expected in Protocol[...] [misc]
13+
generics_basic.py:171: error: If Generic[...] or Protocol[...] is present it should list all type variables [misc]
14+
generics_basic.py:172: error: If Generic[...] or Protocol[...] is present it should list all type variables [misc]
15+
generics_basic.py:208: error: Dynamic metaclass not supported for "GenericMetaInstance" [misc]
16+
generics_basic.py:208: error: Type variable "generics_basic.T" is unbound [valid-type]
17+
generics_basic.py:208: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
18+
generics_basic.py:208: note: (Hint: Use "T" in function signature to bind "T" inside a function)
1719
"""
18-
conformance_automated = "Fail"
20+
conformance_automated = "Pass"
1921
errors_diff = """
20-
Line 55: Expected 1 errors
2122
"""

0 commit comments

Comments
 (0)