Skip to content

Commit

Permalink
Incorporated PR feedback from @hauntsaninja.
Browse files Browse the repository at this point in the history
  • Loading branch information
erictraut committed Jan 4, 2024
1 parent 9fed0f9 commit 1593ab5
Show file tree
Hide file tree
Showing 53 changed files with 370 additions and 179 deletions.
18 changes: 9 additions & 9 deletions conformance/results/mypy/annotations_generators.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ notes = """
Does not report incompatible Generator type in `yield from` statement.
"""
output = """
annotations_generators.py:50: error: Missing return statement [return]
annotations_generators.py:53: error: Incompatible return value type (got "bool", expected "C") [return-value]
annotations_generators.py:56: error: Incompatible types in "yield" (actual type "int", expected type "A") [misc]
annotations_generators.py:65: error: Incompatible types in "yield" (actual type "int", expected type "A") [misc]
annotations_generators.py:74: error: Incompatible types in "yield" (actual type "B", expected type "A") [misc]
annotations_generators.py:85: error: The return type of a generator function should be "Generator" or one of its supertypes [misc]
annotations_generators.py:90: error: The return type of an async generator function should be "AsyncGenerator" or one of its supertypes [misc]
annotations_generators.py:117: error: Incompatible types in "yield from" (actual type "A", expected type "B") [misc]
annotations_generators.py:118: error: Incompatible types in "yield from" (actual type "int", expected type "B") [misc]
annotations_generators.py:51: error: Missing return statement [return]
annotations_generators.py:54: error: Incompatible return value type (got "bool", expected "C") [return-value]
annotations_generators.py:57: error: Incompatible types in "yield" (actual type "int", expected type "A") [misc]
annotations_generators.py:66: error: Incompatible types in "yield" (actual type "int", expected type "A") [misc]
annotations_generators.py:75: error: Incompatible types in "yield" (actual type "B", expected type "A") [misc]
annotations_generators.py:86: error: The return type of a generator function should be "Generator" or one of its supertypes [misc]
annotations_generators.py:91: error: The return type of an async generator function should be "AsyncGenerator" or one of its supertypes [misc]
annotations_generators.py:118: error: Incompatible types in "yield from" (actual type "A", expected type "B") [misc]
annotations_generators.py:119: error: Incompatible types in "yield from" (actual type "int", expected type "B") [misc]
"""
4 changes: 4 additions & 0 deletions conformance/results/mypy/annotations_methods.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
conformant = "Pass"
notes = """
Type evaluation differs from other type checkers because of ambiguity in the spec related to method bindings.
"""
output = """
annotations_methods.py:42: error: Expression is of type "B", not "A" [assert-type]
"""
11 changes: 6 additions & 5 deletions conformance/results/mypy/directives_assert_type.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ conformant = "Pass"
output = """
directives_assert_type.py:27: error: Expression is of type "int | str", not "int" [assert-type]
directives_assert_type.py:28: error: Expression is of type "Any", not "int" [assert-type]
directives_assert_type.py:30: error: "assert_type" expects 2 arguments [misc]
directives_assert_type.py:30: error: Too few arguments for "assert_type" [call-arg]
directives_assert_type.py:31: error: Expression is of type "Literal['']", not "int" [assert-type]
directives_assert_type.py:32: error: "assert_type" expects 2 arguments [misc]
directives_assert_type.py:32: error: Too many arguments for "assert_type" [call-arg]
directives_assert_type.py:29: error: Expression is of type "Literal[4]", not "int" [assert-type]
directives_assert_type.py:31: error: "assert_type" expects 2 arguments [misc]
directives_assert_type.py:31: error: Too few arguments for "assert_type" [call-arg]
directives_assert_type.py:32: error: Expression is of type "Literal['']", not "int" [assert-type]
directives_assert_type.py:33: error: "assert_type" expects 2 arguments [misc]
directives_assert_type.py:33: error: Too many arguments for "assert_type" [call-arg]
"""
3 changes: 3 additions & 0 deletions conformance/results/mypy/directives_type_ignore_file1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
conformant = "Pass"
output = """
"""
4 changes: 4 additions & 0 deletions conformance/results/mypy/directives_type_ignore_file2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
conformant = "Pass"
output = """
directives_type_ignore_file2.py:14: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]
"""
12 changes: 6 additions & 6 deletions conformance/results/mypy/overloads_basic.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
conformant = "Pass"
output = """
overloads_basic.py:35: error: No overload variant of "__getitem__" of "Bytes" matches argument type "str" [call-overload]
overloads_basic.py:35: note: Possible overload variants:
overloads_basic.py:35: note: def __getitem__(self, int, /) -> int
overloads_basic.py:35: note: def __getitem__(self, slice, /) -> bytes
overloads_basic.py:59: error: Single overload definition, multiple required [misc]
overloads_basic.py:69: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]
overloads_basic.py:37: error: No overload variant of "__getitem__" of "Bytes" matches argument type "str" [call-overload]
overloads_basic.py:37: note: Possible overload variants:
overloads_basic.py:37: note: def __getitem__(self, int, /) -> int
overloads_basic.py:37: note: def __getitem__(self, slice, /) -> bytes
overloads_basic.py:62: error: Single overload definition, multiple required [misc]
overloads_basic.py:74: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]
"""
92 changes: 46 additions & 46 deletions conformance/results/mypy/protocols_definition.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,50 @@ Does not detect protocol mismatch if concrete method's parameters are position-o
"""
output = """
protocols_definition.py:30: error: List item 0 has incompatible type "int"; expected "SupportsClose" [list-item]
protocols_definition.py:62: error: Protocol members cannot be defined via assignment to self [misc]
protocols_definition.py:62: error: "Template" has no attribute "temp" [attr-defined]
protocols_definition.py:109: error: Incompatible types in assignment (expression has type "Concrete2_Good2", variable has type "Template2") [assignment]
protocols_definition.py:109: note: Protocol member Template2.val1 expected class variable, got instance variable
protocols_definition.py:110: error: Incompatible types in assignment (expression has type "Concrete2_Bad1", variable has type "Template2") [assignment]
protocols_definition.py:111: error: Incompatible types in assignment (expression has type "Concrete2_Bad2", variable has type "Template2") [assignment]
protocols_definition.py:111: note: Following member(s) of "Concrete2_Bad2" have conflicts:
protocols_definition.py:111: note: val1: expected "Sequence[int]", got "Sequence[float]"
protocols_definition.py:111: note: Protocol member Template2.val1 expected class variable, got instance variable
protocols_definition.py:112: error: Incompatible types in assignment (expression has type "Concrete2_Bad3", variable has type "Template2") [assignment]
protocols_definition.py:112: note: Following member(s) of "Concrete2_Bad3" have conflicts:
protocols_definition.py:112: note: val1: expected "Sequence[int]", got "list[int]"
protocols_definition.py:112: note: Protocol member Template2.val1 expected class variable, got instance variable
protocols_definition.py:151: error: Incompatible types in assignment (expression has type "Concrete3_Bad1", variable has type "Template3") [assignment]
protocols_definition.py:152: error: Incompatible types in assignment (expression has type "Concrete3_Bad2", variable has type "Template3") [assignment]
protocols_definition.py:152: note: Protocol member Template3.val1 expected instance variable, got class variable
protocols_definition.py:153: error: Incompatible types in assignment (expression has type "Concrete3_Bad3", variable has type "Template3") [assignment]
protocols_definition.py:153: note: Protocol member Template3.val1 expected settable variable, got read-only attribute
protocols_definition.py:154: error: Incompatible types in assignment (expression has type "Concrete3_Bad4", variable has type "Template3") [assignment]
protocols_definition.py:154: note: Following member(s) of "Concrete3_Bad4" have conflicts:
protocols_definition.py:154: note: val1: expected "Sequence[int]", got "Sequence[float]"
protocols_definition.py:155: error: Incompatible types in assignment (expression has type "Concrete3_Bad5", variable has type "Template3") [assignment]
protocols_definition.py:155: note: Following member(s) of "Concrete3_Bad5" have conflicts:
protocols_definition.py:155: note: val1: expected "Sequence[int]", got "list[int]"
protocols_definition.py:213: error: Incompatible types in assignment (expression has type "Concrete4_Bad1", variable has type "Template4") [assignment]
protocols_definition.py:213: note: Following member(s) of "Concrete4_Bad1" have conflicts:
protocols_definition.py:213: note: val1: expected "Sequence[float]", got "Callable[[], Sequence[int]]"
protocols_definition.py:214: error: Incompatible types in assignment (expression has type "Concrete4_Bad2", variable has type "Template4") [assignment]
protocols_definition.py:276: error: Incompatible types in assignment (expression has type "Concrete5_Bad2", variable has type "Template5") [assignment]
protocols_definition.py:276: note: Following member(s) of "Concrete5_Bad2" have conflicts:
protocols_definition.py:276: note: Expected:
protocols_definition.py:276: note: def method1(self, a: int, b: int) -> float
protocols_definition.py:276: note: Got:
protocols_definition.py:276: note: def method1(self, *, a: int, b: int) -> float
protocols_definition.py:278: error: Incompatible types in assignment (expression has type "Concrete5_Bad5", variable has type "Template5") [assignment]
protocols_definition.py:278: note: Following member(s) of "Concrete5_Bad5" have conflicts:
protocols_definition.py:278: note: Expected:
protocols_definition.py:278: note: def method1(self, a: int, b: int) -> float
protocols_definition.py:278: note: Got:
protocols_definition.py:278: note: def method1(self: Any, a: int, b: int) -> float
protocols_definition.py:328: error: Incompatible types in assignment (expression has type "Concrete6_Bad1", variable has type "Template6") [assignment]
protocols_definition.py:328: note: Protocol member Template6.val1 expected settable variable, got read-only attribute
protocols_definition.py:329: error: Incompatible types in assignment (expression has type "Concrete6_Bad2", variable has type "Template6") [assignment]
protocols_definition.py:329: note: Protocol member Template6.val1 expected settable variable, got read-only attribute
protocols_definition.py:330: error: Incompatible types in assignment (expression has type "Concrete6_Bad3", variable has type "Template6") [assignment]
protocols_definition.py:330: note: Protocol member Template6.val1 expected settable variable, got read-only attribute
protocols_definition.py:67: error: Protocol members cannot be defined via assignment to self [misc]
protocols_definition.py:67: error: "Template" has no attribute "temp" [attr-defined]
protocols_definition.py:114: error: Incompatible types in assignment (expression has type "Concrete2_Good2", variable has type "Template2") [assignment]
protocols_definition.py:114: note: Protocol member Template2.val1 expected class variable, got instance variable
protocols_definition.py:115: error: Incompatible types in assignment (expression has type "Concrete2_Bad1", variable has type "Template2") [assignment]
protocols_definition.py:116: error: Incompatible types in assignment (expression has type "Concrete2_Bad2", variable has type "Template2") [assignment]
protocols_definition.py:116: note: Following member(s) of "Concrete2_Bad2" have conflicts:
protocols_definition.py:116: note: val1: expected "Sequence[int]", got "Sequence[float]"
protocols_definition.py:116: note: Protocol member Template2.val1 expected class variable, got instance variable
protocols_definition.py:117: error: Incompatible types in assignment (expression has type "Concrete2_Bad3", variable has type "Template2") [assignment]
protocols_definition.py:117: note: Following member(s) of "Concrete2_Bad3" have conflicts:
protocols_definition.py:117: note: val1: expected "Sequence[int]", got "list[int]"
protocols_definition.py:117: note: Protocol member Template2.val1 expected class variable, got instance variable
protocols_definition.py:156: error: Incompatible types in assignment (expression has type "Concrete3_Bad1", variable has type "Template3") [assignment]
protocols_definition.py:157: error: Incompatible types in assignment (expression has type "Concrete3_Bad2", variable has type "Template3") [assignment]
protocols_definition.py:157: note: Protocol member Template3.val1 expected instance variable, got class variable
protocols_definition.py:158: error: Incompatible types in assignment (expression has type "Concrete3_Bad3", variable has type "Template3") [assignment]
protocols_definition.py:158: note: Protocol member Template3.val1 expected settable variable, got read-only attribute
protocols_definition.py:159: error: Incompatible types in assignment (expression has type "Concrete3_Bad4", variable has type "Template3") [assignment]
protocols_definition.py:159: note: Following member(s) of "Concrete3_Bad4" have conflicts:
protocols_definition.py:159: note: val1: expected "Sequence[int]", got "Sequence[float]"
protocols_definition.py:160: error: Incompatible types in assignment (expression has type "Concrete3_Bad5", variable has type "Template3") [assignment]
protocols_definition.py:160: note: Following member(s) of "Concrete3_Bad5" have conflicts:
protocols_definition.py:160: note: val1: expected "Sequence[int]", got "list[int]"
protocols_definition.py:218: error: Incompatible types in assignment (expression has type "Concrete4_Bad1", variable has type "Template4") [assignment]
protocols_definition.py:218: note: Following member(s) of "Concrete4_Bad1" have conflicts:
protocols_definition.py:218: note: val1: expected "Sequence[float]", got "Callable[[], Sequence[int]]"
protocols_definition.py:219: error: Incompatible types in assignment (expression has type "Concrete4_Bad2", variable has type "Template4") [assignment]
protocols_definition.py:287: error: Incompatible types in assignment (expression has type "Concrete5_Bad3", variable has type "Template5") [assignment]
protocols_definition.py:287: note: Following member(s) of "Concrete5_Bad3" have conflicts:
protocols_definition.py:287: note: Expected:
protocols_definition.py:287: note: def method1(self, a: int, b: int) -> float
protocols_definition.py:287: note: Got:
protocols_definition.py:287: note: def method1(self, *, a: int, b: int) -> float
protocols_definition.py:289: error: Incompatible types in assignment (expression has type "Concrete5_Bad5", variable has type "Template5") [assignment]
protocols_definition.py:289: note: Following member(s) of "Concrete5_Bad5" have conflicts:
protocols_definition.py:289: note: Expected:
protocols_definition.py:289: note: def method1(self, a: int, b: int) -> float
protocols_definition.py:289: note: Got:
protocols_definition.py:289: note: def method1(self: Any, a: int, b: int) -> float
protocols_definition.py:339: error: Incompatible types in assignment (expression has type "Concrete6_Bad1", variable has type "Template6") [assignment]
protocols_definition.py:339: note: Protocol member Template6.val1 expected settable variable, got read-only attribute
protocols_definition.py:340: error: Incompatible types in assignment (expression has type "Concrete6_Bad2", variable has type "Template6") [assignment]
protocols_definition.py:340: note: Protocol member Template6.val1 expected settable variable, got read-only attribute
protocols_definition.py:341: error: Incompatible types in assignment (expression has type "Concrete6_Bad3", variable has type "Template6") [assignment]
protocols_definition.py:341: note: Protocol member Template6.val1 expected settable variable, got read-only attribute
"""
1 change: 1 addition & 0 deletions conformance/results/mypy/protocols_merging.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ protocols_merging.py:53: note: __len__
protocols_merging.py:54: error: Incompatible types in assignment (expression has type "SCConcrete2", variable has type "SizedAndClosable3") [assignment]
protocols_merging.py:68: error: All bases of a protocol must be protocols [misc]
protocols_merging.py:83: error: Cannot instantiate abstract class "SizedAndClosable4" with abstract attribute "close" [abstract]
protocols_merging.py:84: error: Incompatible types in assignment (expression has type "SCConcrete1", variable has type "SizedAndClosable4") [assignment]
"""
2 changes: 1 addition & 1 deletion conformance/results/mypy/version.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "mypy 1.8.0"
test_duration = 1.3135571479797363
test_duration = 0.6594910621643066
Loading

0 comments on commit 1593ab5

Please sign in to comment.