Skip to content

Commit f2f4c40

Browse files
authored
Add Pyrefly (#2080)
* add pyrefly type checker * manually audit pyrefly results * update repoort * mark mostly/completely unsupported features as such * regenerate HTML
1 parent 5c92562 commit f2f4c40

File tree

143 files changed

+2440
-20
lines changed

Some content is hidden

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

143 files changed

+2440
-20
lines changed

conformance/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ mypy
55
pip
66
pyre-check; platform_system != "Windows"
77
zuban
8+
pyrefly
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
conformance_automated = "Pass"
2+
errors_diff = """
3+
"""
4+
output = """
5+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:67:9-28: `TypeAlias[GoodTypeAlias2, type[int | None]]` is not subscriptable [unsupported-operation]
6+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:68:9-28: `TypeAlias[GoodTypeAlias3, type[list[int | None]]]` is not subscriptable [unsupported-operation]
7+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:69:9-33: Expected 1 type argument for `GoodTypeAlias4`, got 2 [bad-specialization]
8+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:70:9-33: Expected 1 type argument for `GoodTypeAlias8`, got 2 [bad-specialization]
9+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:71:9-33: Expected a valid ParamSpec expression, got `int` [invalid-param-spec]
10+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:79:21-61: function call cannot be used in annotations [invalid-annotation]
11+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:80:21-31: list literal cannot be used in annotations [invalid-annotation]
12+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:81:21-34: tuple literal cannot be used in annotations [invalid-annotation]
13+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:82:21-44: list comprehension cannot be used in annotations [invalid-annotation]
14+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:83:21-31: dict literal cannot be used in annotations [invalid-annotation]
15+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:83:23-24: Could not find name `a` [unknown-name]
16+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:83:28-29: Could not find name `b` [unknown-name]
17+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:84:21-36: function call cannot be used in annotations [invalid-annotation]
18+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:85:21-29: invalid subscript expression cannot be used in annotations [invalid-annotation]
19+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:86:21-42: if expression cannot be used in annotations [invalid-annotation]
20+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:87:21-25: Expected `BadTypeAlias9` to be a type alias, got `Literal[3]` [type-alias-error]
21+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:88:22-26: bool literal cannot be used in annotations [invalid-annotation]
22+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:89:22-23: number literal cannot be used in annotations [invalid-annotation]
23+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:90:22-33: boolean operation cannot be used in annotations [invalid-annotation]
24+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:91:22-32: f-string cannot be used in annotations [invalid-annotation]
25+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:100:5-19: `TypeAlias[ListAlias, type[list[Unknown]]]` is not subscriptable [unsupported-operation]
26+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:101:6-20: Expected a callable, got TypeAlias[ListOrSetAlias, type[list[Unknown] | set[Unknown]]] [not-callable]
27+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_explicit.py:102:5-24: `TypeAlias[ListOrSetAlias, type[list[Unknown] | set[Unknown]]]` is not subscriptable [unsupported-operation]
28+
"""
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
conformant = "Partial"
2+
notes = """
3+
Does not reject invalid syntax in implicit type aliases.
4+
"""
5+
conformance_automated = "Fail"
6+
errors_diff = """
7+
Line 106: Expected 1 errors
8+
Line 111: Expected 1 errors
9+
Line 112: Expected 1 errors
10+
Line 113: Expected 1 errors
11+
Line 117: Expected 1 errors
12+
"""
13+
output = """
14+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:76:9-28: `type[int | None]` is not subscriptable [unsupported-operation]
15+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:77:9-28: `type[list[int | None]]` is not subscriptable [unsupported-operation]
16+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:78:9-33: Expected 1 type argument for `GoodTypeAlias4`, got 2 [bad-specialization]
17+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:79:9-33: Expected 1 type argument for `GoodTypeAlias8`, got 2 [bad-specialization]
18+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:80:9-33: Expected a valid ParamSpec expression, got `int` [invalid-param-spec]
19+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:81:9-29: Type `str` is not assignable to upper bound `float` of type variable `TFloat` [bad-specialization]
20+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:107:9-22: Expected a type form, got instance of `list[type[int] | type[str]]` [not-a-type]
21+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:108:9-22: Expected a type form, got instance of `tuple[tuple[type[int], type[str]]]` [not-a-type]
22+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:109:9-22: Expected a type form, got instance of `list[type[int]]` [not-a-type]
23+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:110:9-22: Expected a type form, got instance of `dict[str, str]` [not-a-type]
24+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:114:9-22: Expected a type form, got instance of `Literal[3]` [not-a-type]
25+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:115:10-24: Expected a type form, got instance of `Literal[True]` [not-a-type]
26+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:116:10-24: Expected a type form, got instance of `Literal[1]` [not-a-type]
27+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:118:10-24: Expected a type form, got instance of `Literal['int']` [not-a-type]
28+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:119:10-24: Expected a type form, got instance of `Literal['int | str']` [not-a-type]
29+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:133:6-20: Expected a callable, got type[list[Unknown] | set[Unknown]] [not-callable]
30+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_implicit.py:135:5-24: `type[list[Unknown] | set[Unknown]]` is not subscriptable [unsupported-operation]
31+
"""
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
conformance_automated = "Pass"
2+
errors_diff = """
3+
"""
4+
output = """
5+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_newtype.py:11:8-14: Argument `Literal['user']` is not assignable to parameter `_x` with type `int` in function `UserId.__new__` [bad-argument-type]
6+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_newtype.py:12:14-16: `Literal[42]` is not assignable to `UserId` [bad-assignment]
7+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_newtype.py:18:11-17: `type[UserId]` is not assignable to `type` [bad-assignment]
8+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_newtype.py:23:16-22: NewType `UserId` not allowed in isinstance() [invalid-argument]
9+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_newtype.py:26:21-27: Subclassing a NewType not allowed [invalid-inheritance]
10+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_newtype.py:35:20-29: Expected string literal "GoodName" [invalid-argument]
11+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_newtype.py:41:6-23: Expected 0 type arguments for `GoodNewType1`, got 1 [bad-specialization]
12+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_newtype.py:47:38-47: Second argument to NewType is invalid [invalid-argument]
13+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_newtype.py:50:38-45: Second argument to NewType cannot be an unbound generic [invalid-argument]
14+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_newtype.py:52:38-46: Second argument to NewType cannot be a protocol [invalid-argument]
15+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_newtype.py:54:38-48: Second argument to NewType is invalid [invalid-argument]
16+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_newtype.py:61:38-41: Second argument to NewType is invalid [invalid-argument]
17+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_newtype.py:63:43-46: Expected 2 positional arguments, got 3 in function `typing.NewType.__init__` [bad-argument-count]
18+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_newtype.py:65:38-41: Second argument to NewType is invalid [invalid-argument]
19+
"""
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
conformant = "Unsupported"
2+
conformance_automated = "Fail"
3+
errors_diff = """
4+
Line 19: Expected 1 errors
5+
Line 20: Expected 1 errors
6+
Line 38: Expected 1 errors
7+
Line 39: Expected 1 errors
8+
Line 50: Expected 1 errors
9+
Line 51: Expected 1 errors
10+
Line 52: Expected 1 errors
11+
Line 72: Expected 1 errors
12+
Line 75: Expected 1 errors
13+
Line 30: Unexpected errors ["Expected a type form, got instance of `Literal['RecursiveTuple']` [not-a-type]"]
14+
Line 42: Unexpected errors ["Expected a type form, got instance of `Literal['RecursiveMapping']` [not-a-type]"]
15+
Line 58: Unexpected errors ['Expected a type form, got instance of `_SpecialForm` [not-a-type]']
16+
Line 59: Unexpected errors ['`type[list[Unknown]]` is not subscriptable [unsupported-operation]']
17+
Line 62: Unexpected errors ['`type[list[Unknown]]` is not subscriptable [unsupported-operation]']
18+
Line 65: Unexpected errors ['Expected a type form, got instance of `_SpecialForm` [not-a-type]']
19+
Line 67: Unexpected errors ['`type[list[Unknown]]` is not subscriptable [unsupported-operation]']
20+
Line 68: Unexpected errors ['`type[list[Unknown]]` is not subscriptable [unsupported-operation]']
21+
"""
22+
output = """
23+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_recursive.py:30:36-52: Expected a type form, got instance of `Literal['RecursiveTuple']` [not-a-type]
24+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_recursive.py:42:45-63: Expected a type form, got instance of `Literal['RecursiveMapping']` [not-a-type]
25+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_recursive.py:58:26-54: Expected a type form, got instance of `_SpecialForm` [not-a-type]
26+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_recursive.py:59:25-47: `type[list[Unknown]]` is not subscriptable [unsupported-operation]
27+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_recursive.py:62:5-27: `type[list[Unknown]]` is not subscriptable [unsupported-operation]
28+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_recursive.py:63:5-27: `type[list[Unknown]]` is not subscriptable [unsupported-operation]
29+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_recursive.py:65:26-63: Expected a type form, got instance of `_SpecialForm` [not-a-type]
30+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_recursive.py:67:5-32: `type[list[Unknown]]` is not subscriptable [unsupported-operation]
31+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_recursive.py:68:5-34: `type[list[Unknown]]` is not subscriptable [unsupported-operation]
32+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_recursive.py:69:5-32: `type[list[Unknown]]` is not subscriptable [unsupported-operation]
33+
"""
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
conformant = "Partial"
2+
notes = """
3+
Does not reject type alias defined with type statement in base class list
4+
Does not reject redeclaration of type alias with the same name.
5+
Does not detect circular definitions.
6+
"""
7+
conformance_automated = "Fail"
8+
errors_diff = """
9+
Line 26: Expected 1 errors
10+
Line 82: Expected 1 errors
11+
Line 84: Expected 1 errors
12+
Lines 51, 52: Expected error (tag 'TA14')
13+
Lines 88, 89: Expected error (tag 'RTA6')
14+
"""
15+
output = """
16+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:17:1-21: Object of class `TypeAliasType` has no attribute `bit_count` [missing-attribute]
17+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:19:1-11: Expected a callable, got TypeAlias[GoodAlias1, type[int]] [not-callable]
18+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:23:7-30: Object of class `TypeAliasType` has no attribute `other_attrib` [missing-attribute]
19+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:31:22-32: Expected class object, got `TypeAliasType` [invalid-argument]
20+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:37:22-62: function call cannot be used in annotations [invalid-annotation]
21+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:38:22-32: list literal cannot be used in annotations [invalid-annotation]
22+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:39:22-35: tuple literal cannot be used in annotations [invalid-annotation]
23+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:40:22-45: list comprehension cannot be used in annotations [invalid-annotation]
24+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:41:22-32: dict literal cannot be used in annotations [invalid-annotation]
25+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:41:24-25: Could not find name `a` [unknown-name]
26+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:41:29-30: Could not find name `b` [unknown-name]
27+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:42:22-37: function call cannot be used in annotations [invalid-annotation]
28+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:43:22-30: invalid subscript expression cannot be used in annotations [invalid-annotation]
29+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:44:22-43: if expression cannot be used in annotations [invalid-annotation]
30+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:45:22-26: Expected `BadTypeAlias9` to be a type alias, got `Literal[1]` [type-alias-error]
31+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:46:23-27: bool literal cannot be used in annotations [invalid-annotation]
32+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:47:23-24: number literal cannot be used in annotations [invalid-annotation]
33+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:48:23-34: boolean operation cannot be used in annotations [invalid-annotation]
34+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:49:23-33: f-string cannot be used in annotations [invalid-annotation]
35+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:56:5-30: `type` statement is not allowed in this context [invalid-syntax]
36+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:62:15-25: Type parameters used in `TA1` but not declared [invalid-type-var]
37+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:67:12-20: Type parameters used in `TA2` but not declared [invalid-type-var]
38+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:77:7-41: Type `str` is not assignable to upper bound `int` of type variable `S` [bad-specialization]
39+
ERROR /Users/dannyyang/Documents/Documents/GitHub/typing/conformance/tests/aliases_type_statement.py:79:7-41: Type `int` is not assignable to upper bound `str` of type variable `T` [bad-specialization]
40+
"""

0 commit comments

Comments
 (0)