Skip to content

Commit d474d74

Browse files
committed
feat: add ty
1 parent 211b0cb commit d474d74

File tree

147 files changed

+2463
-27
lines changed

Some content is hidden

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

147 files changed

+2463
-27
lines changed

conformance/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Note that some type checkers may not run on some platforms. If a type checker fa
8080

8181
Different type checkers report errors in different ways (with different wording in error messages and different line numbers or character ranges for errors). This variation makes it difficult to fully automate test validation given that tests will want to check for both false positive and false negative type errors. Some level of manual inspection will therefore be needed to determine whether a type checker is fully conformant with all tests in any given test file. This "scoring" process is required only when the output of a test changes — e.g. when a new version of that type checker is released and the tests are rerun. We assume that the output of a type checker will be the same from one run to the next unless/until a new version is released that fixes or introduces a bug. In this case, the output will need to be manually inspected and the conformance results re-scored for those tests whose output has changed.
8282

83-
Conformance results are reported and summarized for each supported type checker. Currently, results are reported for mypy, pyrefly, pyright, and zuban. It is the goal and desire to add additional type checkers over time.
83+
Conformance results are reported and summarized for each supported type checker. Currently, results are reported for mypy, pyrefly, pyright, zuban and ty. It is the goal and desire to add additional type checkers over time.
8484

8585
## Adding a New Test Case
8686

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
zuban
77
pyrefly
8+
ty
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = "mypy 1.19.0"
1+
version = "mypy 1.19.1"

conformance/results/pyrefly/protocols_explicit.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ notes = """
33
Does not reject call to super method with no default implementation.
44
Does not detect stub methods inherited from protocols as abstract.
55
"""
6-
conformance_automated = "Fail"
6+
conformance_automated = "Pass"
77
errors_diff = """
8-
Line 89: Expected 1 errors
98
"""
109
output = """
1110
ERROR protocols_explicit.py:27:16-28: Method `draw` inherited from class `PColor` has no implementation and cannot be accessed via `super()` [missing-attribute]
1211
ERROR protocols_explicit.py:56:20-36: `tuple[int, int, str]` is not assignable to attribute `rgb` with type `tuple[int, int, int]` [bad-assignment]
1312
ERROR protocols_explicit.py:60:10-20: Cannot instantiate `Point` because the following members are abstract: `intensity`, `transparency` [bad-instantiation]
13+
ERROR protocols_explicit.py:89:15-17: Cannot instantiate `Concrete1` because the following members are abstract: `cm1` [bad-instantiation]
1414
ERROR protocols_explicit.py:134:15-17: Cannot instantiate `Concrete5` because the following members are abstract: `method1` [bad-instantiation]
1515
ERROR protocols_explicit.py:164:17-19: Cannot instantiate `Concrete7A` because the following members are abstract: `method1` [bad-instantiation]
1616
"""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = "pyrefly 0.45.2"
1+
version = "pyrefly 0.46.0"

conformance/results/results.html

Lines changed: 163 additions & 22 deletions
Large diffs are not rendered by default.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
conformance_automated = "Fail"
2+
errors_diff = """
3+
Line 79: Expected 1 errors
4+
Line 80: Expected 1 errors
5+
Line 81: Expected 1 errors
6+
Line 82: Expected 1 errors
7+
Line 83: Expected 1 errors
8+
Line 84: Expected 1 errors
9+
Line 85: Expected 1 errors
10+
Line 86: Expected 1 errors
11+
Line 87: Expected 1 errors
12+
Line 88: Expected 1 errors
13+
Line 89: Expected 1 errors
14+
Line 90: Expected 1 errors
15+
Line 91: Expected 1 errors
16+
Line 100: Expected 1 errors
17+
Line 57: Unexpected errors ['aliases_explicit.py:57:5 - major: type-assertion-failure: Argument does not have asserted type `(int, str, str, /) -> None` (type-assertion-failure)']
18+
"""
19+
output = """
20+
aliases_explicit.py:57:5 - major: type-assertion-failure: Argument does not have asserted type `(int, str, str, /) -> None` (type-assertion-failure)
21+
aliases_explicit.py:67:9 - major: non-subscriptable: Cannot subscript non-generic type (non-subscriptable)
22+
aliases_explicit.py:68:9 - major: non-subscriptable: Cannot subscript non-generic type (non-subscriptable)
23+
aliases_explicit.py:69:29 - major: invalid-type-arguments: Too many type arguments: expected 1, got 2 (invalid-type-arguments)
24+
aliases_explicit.py:70:29 - major: invalid-type-arguments: Too many type arguments: expected 1, got 2 (invalid-type-arguments)
25+
aliases_explicit.py:71:24 - major: invalid-type-arguments: Type argument for `ParamSpec` must be either a list of types, `ParamSpec`, `Concatenate`, or `...` (invalid-type-arguments)
26+
aliases_explicit.py:101:6 - major: call-non-callable: Object of type `UnionType` is not callable (call-non-callable)
27+
aliases_explicit.py:102:5 - major: non-subscriptable: Cannot subscript non-generic type (non-subscriptable)
28+
"""
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
conformance_automated = "Fail"
2+
errors_diff = """
3+
Line 106: Expected 1 errors
4+
Line 111: Expected 1 errors
5+
Line 112: Expected 1 errors
6+
Line 113: Expected 1 errors
7+
Line 117: Expected 1 errors
8+
Line 68: Unexpected errors ['aliases_implicit.py:68:5 - major: type-assertion-failure: Argument does not have asserted type `(int, str, str, /) -> None` (type-assertion-failure)']
9+
"""
10+
output = """
11+
aliases_implicit.py:68:5 - major: type-assertion-failure: Argument does not have asserted type `(int, str, str, /) -> None` (type-assertion-failure)
12+
aliases_implicit.py:76:9 - major: non-subscriptable: Cannot subscript non-generic type (non-subscriptable)
13+
aliases_implicit.py:77:9 - major: non-subscriptable: Cannot subscript non-generic type (non-subscriptable)
14+
aliases_implicit.py:78:29 - major: invalid-type-arguments: Too many type arguments: expected 1, got 2 (invalid-type-arguments)
15+
aliases_implicit.py:79:29 - major: invalid-type-arguments: Too many type arguments: expected 1, got 2 (invalid-type-arguments)
16+
aliases_implicit.py:80:24 - major: invalid-type-arguments: Type argument for `ParamSpec` must be either a list of types, `ParamSpec`, `Concatenate`, or `...` (invalid-type-arguments)
17+
aliases_implicit.py:81:25 - major: invalid-type-arguments: Type `str` is not assignable to upper bound `int | float` of type variable `TFloat@GoodTypeAlias12` (invalid-type-arguments)
18+
aliases_implicit.py:107:9 - major: invalid-type-form: Variable of type `list[Unknown | <class 'int'> | <class 'str'>]` is not allowed in a type expression (invalid-type-form)
19+
aliases_implicit.py:108:9 - major: invalid-type-form: Variable of type `tuple[tuple[<class 'int'>, <class 'str'>]]` is not allowed in a type expression (invalid-type-form)
20+
aliases_implicit.py:109:9 - major: invalid-type-form: Variable of type `list[<class 'int'> | Unknown]` is not allowed in a type expression (invalid-type-form)
21+
aliases_implicit.py:110:9 - major: invalid-type-form: Variable of type `dict[Unknown | str, Unknown | str]` is not allowed in a type expression (invalid-type-form)
22+
aliases_implicit.py:114:9 - major: invalid-type-form: Variable of type `Literal[3]` is not allowed in a type expression (invalid-type-form)
23+
aliases_implicit.py:115:10 - major: invalid-type-form: Variable of type `Literal[True]` is not allowed in a type expression (invalid-type-form)
24+
aliases_implicit.py:116:10 - major: invalid-type-form: Variable of type `Literal[1]` is not allowed in a type expression (invalid-type-form)
25+
aliases_implicit.py:118:10 - major: invalid-type-form: Variable of type `Literal["int"]` is not allowed in a type expression (invalid-type-form)
26+
aliases_implicit.py:119:10 - major: invalid-type-form: Variable of type `Literal["int | str"]` is not allowed in a type expression (invalid-type-form)
27+
aliases_implicit.py:133:6 - major: call-non-callable: Object of type `UnionType` is not callable (call-non-callable)
28+
aliases_implicit.py:135:5 - major: non-subscriptable: Cannot subscript non-generic type (non-subscriptable)
29+
"""
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
conformance_automated = "Fail"
2+
errors_diff = """
3+
Line 50: Expected 1 errors
4+
"""
5+
output = """
6+
aliases_newtype.py:11:8 - major: invalid-argument-type: Argument is incorrect (invalid-argument-type)
7+
aliases_newtype.py:12:14 - major: invalid-assignment: Object of type `Literal[42]` is not assignable to `UserId` (invalid-assignment)
8+
aliases_newtype.py:18:11 - major: invalid-assignment: Object of type `<NewType pseudo-class 'UserId'>` is not assignable to `type` (invalid-assignment)
9+
aliases_newtype.py:23:16 - major: invalid-argument-type: Argument to function `isinstance` is incorrect (invalid-argument-type)
10+
aliases_newtype.py:26:21 - major: invalid-base: Cannot subclass an instance of NewType (invalid-base)
11+
aliases_newtype.py:35:1 - major: invalid-newtype: The name of a `NewType` (`BadName`) must match the name of the variable it is assigned to (`GoodName`) (invalid-newtype)
12+
aliases_newtype.py:41:6 - major: invalid-type-form: `GoodNewType1` is a `NewType` and cannot be specialized (invalid-type-form)
13+
aliases_newtype.py:47:38 - major: invalid-newtype: invalid base for `typing.NewType` (invalid-newtype)
14+
aliases_newtype.py:52:38 - major: invalid-newtype: invalid base for `typing.NewType` (invalid-newtype)
15+
aliases_newtype.py:54:38 - major: invalid-newtype: invalid base for `typing.NewType` (invalid-newtype)
16+
aliases_newtype.py:61:38 - major: invalid-newtype: invalid base for `typing.NewType` (invalid-newtype)
17+
aliases_newtype.py:63:15 - major: invalid-newtype: Wrong number of arguments in `NewType` creation, expected 2, found 3 (invalid-newtype)
18+
aliases_newtype.py:65:38 - major: invalid-newtype: invalid base for `typing.NewType` (invalid-newtype)
19+
"""
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
conformance_automated = "Fail"
2+
errors_diff = """
3+
Line 19: Expected 1 errors
4+
Line 20: Expected 1 errors
5+
Line 38: Expected 1 errors
6+
Line 39: Expected 1 errors
7+
Line 50: Expected 1 errors
8+
Line 51: Expected 1 errors
9+
Line 52: Expected 1 errors
10+
Line 63: Expected 1 errors
11+
Line 69: Expected 1 errors
12+
Line 72: Expected 1 errors
13+
Line 75: Expected 1 errors
14+
"""
15+
output = """
16+
"""

0 commit comments

Comments
 (0)