Skip to content

Commit 211b0cb

Browse files
authored
Update conformance suite to avoid unsound empty bodies (#2134)
1 parent f6204ef commit 211b0cb

File tree

58 files changed

+363
-349
lines changed

Some content is hidden

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

58 files changed

+363
-349
lines changed

conformance/results/mypy/constructors_call_new.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Does not report errors during binding to cls parameter of __new__ method.
66
"""
77
conformance_automated = "Fail"
88
errors_diff = """
9-
Line 145: Expected 1 errors
9+
Line 148: Expected 1 errors
1010
Line 40: Unexpected errors ['constructors_call_new.py:40: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "Class3") [misc]']
1111
Line 49: Unexpected errors ['constructors_call_new.py:49: error: Expression is of type "Class3", not "int" [assert-type]', 'constructors_call_new.py:49: error: Missing positional argument "x" in call to "Class3" [call-arg]']
1212
Line 57: Unexpected errors ['constructors_call_new.py:57: error: "__new__" must return a class instance (got "Class4 | Any") [misc]']

conformance/results/mypy/constructors_callable.toml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,44 @@ Does not support __new__ return type that is different from class being construc
66
"""
77
conformance_automated = "Fail"
88
errors_diff = """
9-
Line 127: Expected 1 errors
10-
Line 144: Expected 1 errors
11-
Line 73: Unexpected errors ['constructors_callable.py:73: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "Class4") [misc]']
12-
Line 78: Unexpected errors ['constructors_callable.py:78: error: Expression is of type "Class4", not "int" [assert-type]']
13-
Line 100: Unexpected errors ['constructors_callable.py:100: error: Expression is of type "Class5", not "Never" [assert-type]']
14-
Line 105: Unexpected errors ['constructors_callable.py:105: error: Expression is of type "Class5", not "Never" [assert-type]']
15-
Line 116: Unexpected errors ['constructors_callable.py:116: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc]']
16-
Line 126: Unexpected errors ['constructors_callable.py:126: error: Expression is of type "Class6", not "Class6Proxy" [assert-type]', 'constructors_callable.py:126: error: Too few arguments [call-arg]']
17-
Line 143: Unexpected errors ['constructors_callable.py:143: error: Expression is of type "Class6Any", not "Any" [assert-type]', 'constructors_callable.py:143: error: Too few arguments [call-arg]']
9+
Line 129: Expected 1 errors
10+
Line 146: Expected 1 errors
11+
Line 74: Unexpected errors ['constructors_callable.py:74: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "Class4") [misc]']
12+
Line 80: Unexpected errors ['constructors_callable.py:80: error: Expression is of type "Class4", not "int" [assert-type]']
13+
Line 102: Unexpected errors ['constructors_callable.py:102: error: Expression is of type "Class5", not "Never" [assert-type]']
14+
Line 107: Unexpected errors ['constructors_callable.py:107: error: Expression is of type "Class5", not "Never" [assert-type]']
15+
Line 118: Unexpected errors ['constructors_callable.py:118: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc]']
16+
Line 128: Unexpected errors ['constructors_callable.py:128: error: Expression is of type "Class6", not "Class6Proxy" [assert-type]', 'constructors_callable.py:128: error: Too few arguments [call-arg]']
17+
Line 145: Unexpected errors ['constructors_callable.py:145: error: Expression is of type "Class6Any", not "Any" [assert-type]', 'constructors_callable.py:145: error: Too few arguments [call-arg]']
1818
"""
1919
output = """
2020
constructors_callable.py:36: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class1"
2121
constructors_callable.py:38: error: Too few arguments [call-arg]
2222
constructors_callable.py:39: error: Unexpected keyword argument "y" [call-arg]
2323
constructors_callable.py:49: note: Revealed type is "def () -> constructors_callable.Class2"
2424
constructors_callable.py:51: error: Too many arguments [call-arg]
25-
constructors_callable.py:63: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class3"
26-
constructors_callable.py:65: error: Too few arguments [call-arg]
27-
constructors_callable.py:66: error: Unexpected keyword argument "y" [call-arg]
28-
constructors_callable.py:67: error: Too many arguments [call-arg]
29-
constructors_callable.py:73: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "Class4") [misc]
30-
constructors_callable.py:77: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class4"
31-
constructors_callable.py:78: error: Expression is of type "Class4", not "int" [assert-type]
32-
constructors_callable.py:79: error: Too few arguments [call-arg]
33-
constructors_callable.py:80: error: Unexpected keyword argument "y" [call-arg]
34-
constructors_callable.py:97: note: Revealed type is "def (*args: Any, **kwargs: Any) -> constructors_callable.Class5"
35-
constructors_callable.py:100: error: Expression is of type "Class5", not "Never" [assert-type]
36-
constructors_callable.py:105: error: Expression is of type "Class5", not "Never" [assert-type]
37-
constructors_callable.py:116: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc]
38-
constructors_callable.py:125: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class6"
39-
constructors_callable.py:126: error: Expression is of type "Class6", not "Class6Proxy" [assert-type]
40-
constructors_callable.py:126: error: Too few arguments [call-arg]
41-
constructors_callable.py:142: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class6Any"
42-
constructors_callable.py:143: error: Expression is of type "Class6Any", not "Any" [assert-type]
43-
constructors_callable.py:143: error: Too few arguments [call-arg]
44-
constructors_callable.py:162: note: Revealed type is "Overload(def (x: builtins.int) -> constructors_callable.Class7[builtins.int], def (x: builtins.str) -> constructors_callable.Class7[builtins.str])"
45-
constructors_callable.py:182: note: Revealed type is "def [T] (x: builtins.list[T`1], y: builtins.list[T`1]) -> constructors_callable.Class8[T`1]"
46-
constructors_callable.py:184: error: Cannot infer function type argument [misc]
47-
constructors_callable.py:193: note: Revealed type is "def [T] (x: builtins.list[T`-1], y: builtins.list[T`-1]) -> constructors_callable.Class9"
48-
constructors_callable.py:195: error: Cannot infer function type argument [misc]
25+
constructors_callable.py:64: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class3"
26+
constructors_callable.py:66: error: Too few arguments [call-arg]
27+
constructors_callable.py:67: error: Unexpected keyword argument "y" [call-arg]
28+
constructors_callable.py:68: error: Too many arguments [call-arg]
29+
constructors_callable.py:74: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "Class4") [misc]
30+
constructors_callable.py:79: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class4"
31+
constructors_callable.py:80: error: Expression is of type "Class4", not "int" [assert-type]
32+
constructors_callable.py:81: error: Too few arguments [call-arg]
33+
constructors_callable.py:82: error: Unexpected keyword argument "y" [call-arg]
34+
constructors_callable.py:99: note: Revealed type is "def (*args: Any, **kwargs: Any) -> constructors_callable.Class5"
35+
constructors_callable.py:102: error: Expression is of type "Class5", not "Never" [assert-type]
36+
constructors_callable.py:107: error: Expression is of type "Class5", not "Never" [assert-type]
37+
constructors_callable.py:118: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc]
38+
constructors_callable.py:127: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class6"
39+
constructors_callable.py:128: error: Expression is of type "Class6", not "Class6Proxy" [assert-type]
40+
constructors_callable.py:128: error: Too few arguments [call-arg]
41+
constructors_callable.py:144: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class6Any"
42+
constructors_callable.py:145: error: Expression is of type "Class6Any", not "Any" [assert-type]
43+
constructors_callable.py:145: error: Too few arguments [call-arg]
44+
constructors_callable.py:164: note: Revealed type is "Overload(def (x: builtins.int) -> constructors_callable.Class7[builtins.int], def (x: builtins.str) -> constructors_callable.Class7[builtins.str])"
45+
constructors_callable.py:184: note: Revealed type is "def [T] (x: builtins.list[T`1], y: builtins.list[T`1]) -> constructors_callable.Class8[T`1]"
46+
constructors_callable.py:186: error: Cannot infer function type argument [misc]
47+
constructors_callable.py:195: note: Revealed type is "def [T] (x: builtins.list[T`-1], y: builtins.list[T`-1]) -> constructors_callable.Class9"
48+
constructors_callable.py:197: error: Cannot infer function type argument [misc]
4949
"""

conformance/results/mypy/generics_defaults.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ generics_defaults.py:79: error: Expression is of type "type[Class_ParamSpec[Defa
1414
generics_defaults.py:94: error: Expression is of type "type[Class_TypeVarTuple[*DefaultTs]]", not "type[Class_TypeVarTuple[str, int]]" [assert-type]
1515
generics_defaults.py:107: error: TypeVar default must be a subtype of the bound type [misc]
1616
generics_defaults.py:114: error: TypeVar default must be one of the constraint types [misc]
17-
generics_defaults.py:131: error: Expression is of type "int", not "Any" [assert-type]
18-
generics_defaults.py:155: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [float, bool]]]" [assert-type]
19-
generics_defaults.py:155: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]
20-
generics_defaults.py:156: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [bytes]]]" [assert-type]
17+
generics_defaults.py:132: error: Expression is of type "int", not "Any" [assert-type]
18+
generics_defaults.py:156: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [float, bool]]]" [assert-type]
2119
generics_defaults.py:156: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]
22-
generics_defaults.py:170: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [assert-type]
20+
generics_defaults.py:157: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [bytes]]]" [assert-type]
21+
generics_defaults.py:157: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]
22+
generics_defaults.py:171: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [assert-type]
2323
"""
2424
conformance_automated = "Fail"
2525
errors_diff = """
26-
Line 142: Expected 1 errors
26+
Line 143: Expected 1 errors
2727
Line 30: Unexpected errors ['generics_defaults.py:30: error: Expression is of type "type[NoNonDefaults[DefaultStrT, DefaultIntT]]", not "type[NoNonDefaults[str, int]]" [assert-type]']
2828
Line 31: Unexpected errors ['generics_defaults.py:31: error: Expression is of type "type[NoNonDefaults[str, DefaultIntT]]", not "type[NoNonDefaults[str, int]]" [assert-type]']
2929
Line 38: Unexpected errors ['generics_defaults.py:38: error: Expression is of type "type[OneDefault[float, DefaultBoolT]]", not "type[OneDefault[float, bool]]" [assert-type]']
@@ -34,7 +34,7 @@ Line 55: Unexpected errors ['generics_defaults.py:55: error: Expression is of ty
3434
Line 59: Unexpected errors ['generics_defaults.py:59: error: Expression is of type "type[AllTheDefaults[int, complex, str, int, DefaultBoolT]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]']
3535
Line 79: Unexpected errors ['generics_defaults.py:79: error: Expression is of type "type[Class_ParamSpec[DefaultP]]", not "type[Class_ParamSpec[[str, int]]]" [assert-type]']
3636
Line 94: Unexpected errors ['generics_defaults.py:94: error: Expression is of type "type[Class_TypeVarTuple[*DefaultTs]]", not "type[Class_TypeVarTuple[str, int]]" [assert-type]']
37-
Line 155: Unexpected errors ['generics_defaults.py:155: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [float, bool]]]" [assert-type]', 'generics_defaults.py:155: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]']
38-
Line 156: Unexpected errors ['generics_defaults.py:156: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [bytes]]]" [assert-type]', 'generics_defaults.py:156: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]']
39-
Line 170: Unexpected errors ['generics_defaults.py:170: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [assert-type]']
37+
Line 156: Unexpected errors ['generics_defaults.py:156: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [float, bool]]]" [assert-type]', 'generics_defaults.py:156: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]']
38+
Line 157: Unexpected errors ['generics_defaults.py:157: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [bytes]]]" [assert-type]', 'generics_defaults.py:157: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]']
39+
Line 171: Unexpected errors ['generics_defaults.py:171: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [assert-type]']
4040
"""

conformance/results/mypy/generics_self_basic.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ conformant = "Pass"
22
output = """
33
generics_self_basic.py:20: error: Incompatible return value type (got "Shape", expected "Self") [return-value]
44
generics_self_basic.py:33: error: Incompatible return value type (got "Shape", expected "Self") [return-value]
5-
generics_self_basic.py:67: error: Self type cannot have type arguments [misc]
5+
generics_self_basic.py:68: error: Self type cannot have type arguments [misc]
66
"""
77
conformance_automated = "Pass"
88
errors_diff = """

conformance/results/mypy/generics_self_usage.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ generics_self_usage.py:76: error: Self type is only allowed in annotations withi
55
generics_self_usage.py:82: error: Method cannot have explicit self annotation and Self type [misc]
66
generics_self_usage.py:82: error: A function returning TypeVar should receive at least one argument containing the same TypeVar [type-var]
77
generics_self_usage.py:82: note: Consider using the upper bound "Foo2" instead
8-
generics_self_usage.py:86: error: Incompatible return value type (got "Foo3", expected "Self") [return-value]
9-
generics_self_usage.py:101: error: Self type is only allowed in annotations within class definition [misc]
8+
generics_self_usage.py:87: error: Incompatible return value type (got "Foo3", expected "Self") [return-value]
109
generics_self_usage.py:103: error: Self type is only allowed in annotations within class definition [misc]
11-
generics_self_usage.py:106: error: Self type is only allowed in annotations within class definition [misc]
12-
generics_self_usage.py:106: error: Self type cannot be used in type alias target [misc]
13-
generics_self_usage.py:111: error: Static methods cannot use Self type [misc]
14-
generics_self_usage.py:111: error: A function returning TypeVar should receive at least one argument containing the same TypeVar [type-var]
15-
generics_self_usage.py:111: note: Consider using the upper bound "Base" instead
16-
generics_self_usage.py:116: error: Static methods cannot use Self type [misc]
17-
generics_self_usage.py:121: error: Self type cannot be used in a metaclass [misc]
18-
generics_self_usage.py:125: error: Self type cannot be used in a metaclass [misc]
10+
generics_self_usage.py:105: error: Self type is only allowed in annotations within class definition [misc]
11+
generics_self_usage.py:108: error: Self type is only allowed in annotations within class definition [misc]
12+
generics_self_usage.py:108: error: Self type cannot be used in type alias target [misc]
13+
generics_self_usage.py:113: error: Static methods cannot use Self type [misc]
14+
generics_self_usage.py:113: error: A function returning TypeVar should receive at least one argument containing the same TypeVar [type-var]
15+
generics_self_usage.py:113: note: Consider using the upper bound "Base" instead
16+
generics_self_usage.py:118: error: Static methods cannot use Self type [misc]
17+
generics_self_usage.py:123: error: Self type cannot be used in a metaclass [misc]
18+
generics_self_usage.py:127: error: Self type cannot be used in a metaclass [misc]
1919
"""
2020
conformance_automated = "Pass"
2121
errors_diff = """

conformance/results/mypy/overloads_definitions.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ notes = """
44
Allows @override to be on all overloads and implementation, instead of just implementation.
55
"""
66
errors_diff = """
7-
Lines 220, 221, 222, 225, 226: Expected error (tag 'override_impl')
7+
Lines 226, 227, 228, 231, 232: Expected error (tag 'override_impl')
88
"""
99
output = """
1010
overloads_definitions.py:15: error: Single overload definition, multiple required [misc]
1111
overloads_definitions.py:27: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]
1212
overloads_definitions.py:58: error: An overloaded function outside a stub file must have an implementation [no-overload-impl]
1313
overloads_definitions.py:71: error: Overload does not consistently use the "@staticmethod" decorator on all function signatures. [misc]
1414
overloads_definitions.py:84: error: Overload does not consistently use the "@classmethod" decorator on all function signatures. [misc]
15-
overloads_definitions.py:121: error: @final should be applied only to overload implementation [misc]
16-
overloads_definitions.py:135: error: @final should be applied only to overload implementation [misc]
17-
overloads_definitions.py:175: error: Cannot override final attribute "final_method" (previously declared in base class "Base") [misc]
18-
overloads_definitions.py:190: error: Method "bad_override" is marked as an override, but no base method was found with this name [misc]
15+
overloads_definitions.py:122: error: @final should be applied only to overload implementation [misc]
16+
overloads_definitions.py:137: error: @final should be applied only to overload implementation [misc]
17+
overloads_definitions.py:180: error: Cannot override final attribute "final_method" (previously declared in base class "Base") [misc]
18+
overloads_definitions.py:195: error: Method "bad_override" is marked as an override, but no base method was found with this name [misc]
1919
"""

0 commit comments

Comments
 (0)