Skip to content

Commit 70d4182

Browse files
authored
Updated conformance tests and results for latest versions of type che… (#1863)
* Updated conformance tests and results for latest versions of type checkers. One test case in the `generics_syntax_infer_variance` was commented out temporarily until we decide how to handle variance inference for dataclasses in Python 3.13. Mypy version was updated from 1.11.1 to 1.11.2. Minor error message change but no other substantive changes to the conformance results. Pyright version was updated from 1.1.374 to 1.1.384. Many error messages changed slightly. Tests also identified three conformance regressions. Pytype version was updated from 2024.04.11 to 2024.09.13. Error message format changed significantly, requiring updates to the test logic. No other substantive changes to conformance results. Changed test infrastructure to make sure old versions of type checkers are uninstalled before installing new to guarantee correct version and increase determinism of timings. * Added "--version" invocation to mypy after installation to eliminate the artificial time associated with malware scanning on MacOS.
1 parent 0f38667 commit 70d4182

File tree

201 files changed

+8378
-2584
lines changed

Some content is hidden

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

201 files changed

+8378
-2584
lines changed

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]

conformance/results/mypy/generics_syntax_infer_variance.toml

Lines changed: 80 additions & 85 deletions
Large diffs are not rendered by default.

conformance/results/mypy/version.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version = "mypy 1.11.1"
2-
test_duration = 13.2
1+
version = "mypy 1.11.2"
2+
test_duration = 1.9

conformance/results/pyre/annotations_forward_refs.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Does not generate error for unquoted type defined in class scope.
88
Does not treat triple-quoted forward reference annotation as implicitly parenthesized.
99
"""
1010
output = """
11-
annotations_forward_refs.py:41:8 Undefined or invalid type [11]: Annotation `eval(.join(map(chr, [105, 110, 116])))` is not defined as a type.
11+
annotations_forward_refs.py:41:8 Invalid type [31]: Expression `eval("".join(map(chr, [105, 110, 116])))` is not a valid type.
1212
annotations_forward_refs.py:42:8 Invalid type [31]: Expression `"[int, str]"` is not a valid type.
1313
annotations_forward_refs.py:43:8 Invalid type [31]: Expression `"(int, str)"` is not a valid type.
1414
annotations_forward_refs.py:44:8 Undefined or invalid type [11]: Annotation `comprehension(int for generators(generator($target$i in range(1) if )))` is not defined as a type.

conformance/results/pyre/generics_syntax_infer_variance.toml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ notes = """
33
Type parameter syntax not yet support.
44
"""
55
output = """
6-
generics_syntax_infer_variance.py:125:25 Parsing failure [404]: invalid syntax
6+
generics_syntax_infer_variance.py:132:25 Parsing failure [404]: invalid syntax
77
"""
88
conformance_automated = "Fail"
99
errors_diff = """
@@ -12,19 +12,18 @@ Line 17: Expected 1 errors
1212
Line 29: Expected 1 errors
1313
Line 37: Expected 1 errors
1414
Line 46: Expected 1 errors
15-
Line 55: Expected 1 errors
16-
Line 68: Expected 1 errors
17-
Line 79: Expected 1 errors
18-
Line 95: Expected 1 errors
19-
Line 96: Expected 1 errors
20-
Line 110: Expected 1 errors
21-
Line 111: Expected 1 errors
15+
Line 75: Expected 1 errors
16+
Line 86: Expected 1 errors
17+
Line 102: Expected 1 errors
18+
Line 103: Expected 1 errors
19+
Line 117: Expected 1 errors
2220
Line 118: Expected 1 errors
23-
Line 119: Expected 1 errors
24-
Line 120: Expected 1 errors
25-
Line 121: Expected 1 errors
26-
Line 129: Expected 1 errors
27-
Line 137: Expected 1 errors
28-
Line 148: Expected 1 errors
29-
Line 125: Unexpected errors ['generics_syntax_infer_variance.py:125:25 Parsing failure [404]: invalid syntax']
21+
Line 125: Expected 1 errors
22+
Line 126: Expected 1 errors
23+
Line 127: Expected 1 errors
24+
Line 128: Expected 1 errors
25+
Line 136: Expected 1 errors
26+
Line 144: Expected 1 errors
27+
Line 155: Expected 1 errors
28+
Line 132: Unexpected errors ['generics_syntax_infer_variance.py:132:25 Parsing failure [404]: invalid syntax']
3029
"""

conformance/results/pyre/version.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version = "pyre 0.9.22"
2-
test_duration = 5.4
2+
test_duration = 4.5

conformance/results/pyright/aliases_explicit.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,40 @@ aliases_explicit.py:71:24 - error: Expected ParamSpec, ellipsis, or list of type
99
aliases_explicit.py:79:21 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
1010
aliases_explicit.py:79:21 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
1111
aliases_explicit.py:80:21 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
12-
aliases_explicit.py:80:21 - error: List expression not allowed in type annotation
12+
aliases_explicit.py:80:21 - error: List expression not allowed in type expression
1313
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
1414
aliases_explicit.py:80:21 - error: Expected class but received "list[Unknown]" (reportGeneralTypeIssues)
1515
aliases_explicit.py:81:21 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
16-
aliases_explicit.py:81:21 - error: Tuple expression not allowed in type annotation
16+
aliases_explicit.py:81:21 - error: Tuple expression not allowed in type expression
1717
  Use tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
1818
aliases_explicit.py:82:21 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
19-
aliases_explicit.py:82:21 - error: List expression not allowed in type annotation
19+
aliases_explicit.py:82:21 - error: List expression not allowed in type expression
2020
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
2121
aliases_explicit.py:82:21 - error: Expected class but received "list[type[int]]" (reportGeneralTypeIssues)
2222
aliases_explicit.py:83:21 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
23-
aliases_explicit.py:83:21 - error: Dictionary expression not allowed in type annotation
23+
aliases_explicit.py:83:21 - error: Dictionary expression not allowed in type expression
2424
  Use Dict[T1, T2] to indicate a dictionary type (reportInvalidTypeForm)
2525
aliases_explicit.py:83:21 - error: Expected class but received "dict[str, Unknown]" (reportGeneralTypeIssues)
2626
aliases_explicit.py:83:28 - error: "b" is not defined (reportUndefinedVariable)
2727
aliases_explicit.py:84:21 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
2828
aliases_explicit.py:84:21 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
2929
aliases_explicit.py:85:21 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
30-
aliases_explicit.py:85:21 - error: List expression not allowed in type annotation
30+
aliases_explicit.py:85:21 - error: List expression not allowed in type expression
3131
  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportInvalidTypeForm)
3232
aliases_explicit.py:85:21 - error: Expected class but received "list[type[int]]" (reportGeneralTypeIssues)
3333
aliases_explicit.py:85:27 - error: Expected class but received "Literal[0]" (reportGeneralTypeIssues)
3434
aliases_explicit.py:86:21 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
35-
aliases_explicit.py:86:21 - error: Ternary expression not allowed in type annotation (reportInvalidTypeForm)
35+
aliases_explicit.py:86:21 - error: Ternary expression not allowed in type expression (reportInvalidTypeForm)
3636
aliases_explicit.py:87:21 - error: Variable not allowed in type expression (reportInvalidTypeForm)
37+
aliases_explicit.py:88:22 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
3738
aliases_explicit.py:88:22 - error: Expected class but received "Literal[True]" (reportGeneralTypeIssues)
3839
aliases_explicit.py:89:22 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
3940
aliases_explicit.py:89:22 - error: Expected class but received "Literal[1]" (reportGeneralTypeIssues)
4041
aliases_explicit.py:90:22 - error: Invalid expression form for type alias definition (reportInvalidTypeForm)
41-
aliases_explicit.py:90:22 - error: Binary operator not allowed in type annotation (reportInvalidTypeForm)
42-
aliases_explicit.py:91:22 - error: Type annotations cannot use format string literals (f-strings) (reportGeneralTypeIssues)
42+
aliases_explicit.py:90:22 - error: Binary operator not allowed in type expression (reportInvalidTypeForm)
43+
aliases_explicit.py:91:22 - error: Type expressions cannot use format string literals (f-strings) (reportGeneralTypeIssues)
4344
aliases_explicit.py:100:5 - error: Type "list[Unknown]" is already specialized (reportInvalidTypeArguments)
44-
aliases_explicit.py:101:6 - error: Object of type "UnionType" is not callable
45-
  Attribute "__call__" is unknown (reportCallIssue)
45+
aliases_explicit.py:101:6 - error: Object of type "UnionType" is not callable (reportCallIssue)
4646
aliases_explicit.py:102:5 - error: Type "list[Unknown]" is already specialized (reportInvalidTypeArguments)
4747
aliases_explicit.py:102:5 - error: Type "set[Unknown]" is already specialized (reportInvalidTypeArguments)
4848
"""

conformance/results/pyright/aliases_implicit.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ aliases_implicit.py:78:29 - error: Too many type arguments provided for "GoodTyp
77
aliases_implicit.py:79:29 - error: Too many type arguments provided for "GoodTypeAlias8[T@GoodTypeAlias8]"; expected 1 but received 2 (reportInvalidTypeForm)
88
aliases_implicit.py:80:24 - error: Expected ParamSpec, ellipsis, or list of types (reportInvalidTypeForm)
99
aliases_implicit.py:81:9 - error: Could not specialize type "GoodTypeAlias12[TFloat@GoodTypeAlias12]"
10-
  Type "str" is incompatible with type "float"
11-
    "str" is incompatible with "float" (reportInvalidTypeForm)
10+
  Type "str" is not assignable to type "float"
11+
    "str" is not assignable to "float" (reportInvalidTypeForm)
1212
aliases_implicit.py:106:9 - error: Variable not allowed in type expression (reportInvalidTypeForm)
1313
aliases_implicit.py:107:9 - error: Variable not allowed in type expression (reportInvalidTypeForm)
1414
aliases_implicit.py:108:9 - error: Variable not allowed in type expression (reportInvalidTypeForm)
@@ -23,8 +23,7 @@ aliases_implicit.py:116:10 - error: Variable not allowed in type expression (rep
2323
aliases_implicit.py:117:10 - error: Variable not allowed in type expression (reportInvalidTypeForm)
2424
aliases_implicit.py:118:10 - error: Variable not allowed in type expression (reportInvalidTypeForm)
2525
aliases_implicit.py:119:10 - error: Variable not allowed in type expression (reportInvalidTypeForm)
26-
aliases_implicit.py:133:6 - error: Object of type "UnionType" is not callable
27-
  Attribute "__call__" is unknown (reportCallIssue)
26+
aliases_implicit.py:133:6 - error: Object of type "UnionType" is not callable (reportCallIssue)
2827
aliases_implicit.py:135:5 - error: Type "list[Unknown]" is already specialized (reportInvalidTypeArguments)
2928
aliases_implicit.py:135:5 - error: Type "set[Unknown]" is already specialized (reportInvalidTypeArguments)
3029
"""

conformance/results/pyright/aliases_newtype.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
conformant = "Pass"
22
output = """
33
aliases_newtype.py:11:8 - error: Argument of type "Literal['user']" cannot be assigned to parameter "_x" of type "int" in function "__init__"
4-
  "Literal['user']" is incompatible with "int" (reportArgumentType)
5-
aliases_newtype.py:12:14 - error: Expression of type "Literal[42]" is incompatible with declared type "UserId"
6-
  "Literal[42]" is incompatible with "UserId" (reportAssignmentType)
4+
  "Literal['user']" is not assignable to "int" (reportArgumentType)
5+
aliases_newtype.py:12:14 - error: Type "Literal[42]" is not assignable to declared type "UserId"
6+
  "Literal[42]" is not assignable to "UserId" (reportAssignmentType)
77
aliases_newtype.py:20:16 - error: Second argument to "isinstance" must be a class or tuple of classes
88
  Class created with NewType cannot be used with instance and class checks (reportArgumentType)
99
aliases_newtype.py:23:21 - error: Base class "UserId" is marked final and cannot be subclassed (reportGeneralTypeIssues)
1010
aliases_newtype.py:32:1 - error: NewType must be assigned to a variable with the same name (reportGeneralTypeIssues)
1111
aliases_newtype.py:38:19 - error: Expected no type arguments for class "GoodNewType1" (reportInvalidTypeArguments)
1212
aliases_newtype.py:44:38 - error: Expected class as second argument to NewType (reportGeneralTypeIssues)
1313
aliases_newtype.py:47:43 - error: Type variable "T" has no meaning in this context (reportGeneralTypeIssues)
14-
aliases_newtype.py:49:38 - error: NewType cannot be used with structural type (a protocol or TypedDict class) (reportGeneralTypeIssues)
14+
aliases_newtype.py:49:38 - error: NewType cannot be used with structural type (a Protocol or TypedDict class) (reportGeneralTypeIssues)
1515
aliases_newtype.py:51:38 - error: NewType cannot be used with Literal type (reportGeneralTypeIssues)
16-
aliases_newtype.py:58:38 - error: NewType cannot be used with structural type (a protocol or TypedDict class) (reportGeneralTypeIssues)
16+
aliases_newtype.py:58:38 - error: NewType cannot be used with structural type (a Protocol or TypedDict class) (reportGeneralTypeIssues)
1717
aliases_newtype.py:60:15 - error: NewType requires two positional arguments (reportCallIssue)
1818
aliases_newtype.py:62:38 - error: The second argument to NewType must be a known class, not Any or Unknown (reportGeneralTypeIssues)
1919
"""

0 commit comments

Comments
 (0)