diff --git a/conformance/results/mypy/constructors_call_new.toml b/conformance/results/mypy/constructors_call_new.toml index 64d15f4b..a325d9e5 100644 --- a/conformance/results/mypy/constructors_call_new.toml +++ b/conformance/results/mypy/constructors_call_new.toml @@ -6,7 +6,7 @@ Does not report errors during binding to cls parameter of __new__ method. """ conformance_automated = "Fail" errors_diff = """ -Line 145: Expected 1 errors +Line 148: Expected 1 errors 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]'] 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]'] Line 57: Unexpected errors ['constructors_call_new.py:57: error: "__new__" must return a class instance (got "Class4 | Any") [misc]'] diff --git a/conformance/results/mypy/constructors_callable.toml b/conformance/results/mypy/constructors_callable.toml index e492d317..0a73c46b 100644 --- a/conformance/results/mypy/constructors_callable.toml +++ b/conformance/results/mypy/constructors_callable.toml @@ -6,15 +6,15 @@ Does not support __new__ return type that is different from class being construc """ conformance_automated = "Fail" errors_diff = """ -Line 127: Expected 1 errors -Line 144: Expected 1 errors -Line 73: Unexpected errors ['constructors_callable.py:73: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "Class4") [misc]'] -Line 78: Unexpected errors ['constructors_callable.py:78: error: Expression is of type "Class4", not "int" [assert-type]'] -Line 100: Unexpected errors ['constructors_callable.py:100: error: Expression is of type "Class5", not "Never" [assert-type]'] -Line 105: Unexpected errors ['constructors_callable.py:105: error: Expression is of type "Class5", not "Never" [assert-type]'] -Line 116: Unexpected errors ['constructors_callable.py:116: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc]'] -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]'] -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]'] +Line 129: Expected 1 errors +Line 146: Expected 1 errors +Line 74: Unexpected errors ['constructors_callable.py:74: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "Class4") [misc]'] +Line 80: Unexpected errors ['constructors_callable.py:80: error: Expression is of type "Class4", not "int" [assert-type]'] +Line 102: Unexpected errors ['constructors_callable.py:102: error: Expression is of type "Class5", not "Never" [assert-type]'] +Line 107: Unexpected errors ['constructors_callable.py:107: error: Expression is of type "Class5", not "Never" [assert-type]'] +Line 118: Unexpected errors ['constructors_callable.py:118: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc]'] +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]'] +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]'] """ output = """ constructors_callable.py:36: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class1" @@ -22,28 +22,28 @@ constructors_callable.py:38: error: Too few arguments [call-arg] constructors_callable.py:39: error: Unexpected keyword argument "y" [call-arg] constructors_callable.py:49: note: Revealed type is "def () -> constructors_callable.Class2" constructors_callable.py:51: error: Too many arguments [call-arg] -constructors_callable.py:63: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class3" -constructors_callable.py:65: error: Too few arguments [call-arg] -constructors_callable.py:66: error: Unexpected keyword argument "y" [call-arg] -constructors_callable.py:67: error: Too many arguments [call-arg] -constructors_callable.py:73: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "Class4") [misc] -constructors_callable.py:77: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class4" -constructors_callable.py:78: error: Expression is of type "Class4", not "int" [assert-type] -constructors_callable.py:79: error: Too few arguments [call-arg] -constructors_callable.py:80: error: Unexpected keyword argument "y" [call-arg] -constructors_callable.py:97: note: Revealed type is "def (*args: Any, **kwargs: Any) -> constructors_callable.Class5" -constructors_callable.py:100: error: Expression is of type "Class5", not "Never" [assert-type] -constructors_callable.py:105: error: Expression is of type "Class5", not "Never" [assert-type] -constructors_callable.py:116: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc] -constructors_callable.py:125: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class6" -constructors_callable.py:126: error: Expression is of type "Class6", not "Class6Proxy" [assert-type] -constructors_callable.py:126: error: Too few arguments [call-arg] -constructors_callable.py:142: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class6Any" -constructors_callable.py:143: error: Expression is of type "Class6Any", not "Any" [assert-type] -constructors_callable.py:143: error: Too few arguments [call-arg] -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])" -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]" -constructors_callable.py:184: error: Cannot infer function type argument [misc] -constructors_callable.py:193: note: Revealed type is "def [T] (x: builtins.list[T`-1], y: builtins.list[T`-1]) -> constructors_callable.Class9" -constructors_callable.py:195: error: Cannot infer function type argument [misc] +constructors_callable.py:64: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class3" +constructors_callable.py:66: error: Too few arguments [call-arg] +constructors_callable.py:67: error: Unexpected keyword argument "y" [call-arg] +constructors_callable.py:68: error: Too many arguments [call-arg] +constructors_callable.py:74: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "Class4") [misc] +constructors_callable.py:79: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class4" +constructors_callable.py:80: error: Expression is of type "Class4", not "int" [assert-type] +constructors_callable.py:81: error: Too few arguments [call-arg] +constructors_callable.py:82: error: Unexpected keyword argument "y" [call-arg] +constructors_callable.py:99: note: Revealed type is "def (*args: Any, **kwargs: Any) -> constructors_callable.Class5" +constructors_callable.py:102: error: Expression is of type "Class5", not "Never" [assert-type] +constructors_callable.py:107: error: Expression is of type "Class5", not "Never" [assert-type] +constructors_callable.py:118: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc] +constructors_callable.py:127: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class6" +constructors_callable.py:128: error: Expression is of type "Class6", not "Class6Proxy" [assert-type] +constructors_callable.py:128: error: Too few arguments [call-arg] +constructors_callable.py:144: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class6Any" +constructors_callable.py:145: error: Expression is of type "Class6Any", not "Any" [assert-type] +constructors_callable.py:145: error: Too few arguments [call-arg] +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])" +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]" +constructors_callable.py:186: error: Cannot infer function type argument [misc] +constructors_callable.py:195: note: Revealed type is "def [T] (x: builtins.list[T`-1], y: builtins.list[T`-1]) -> constructors_callable.Class9" +constructors_callable.py:197: error: Cannot infer function type argument [misc] """ diff --git a/conformance/results/mypy/generics_defaults.toml b/conformance/results/mypy/generics_defaults.toml index ba432041..63ba3c8e 100644 --- a/conformance/results/mypy/generics_defaults.toml +++ b/conformance/results/mypy/generics_defaults.toml @@ -14,16 +14,16 @@ generics_defaults.py:79: error: Expression is of type "type[Class_ParamSpec[Defa generics_defaults.py:94: error: Expression is of type "type[Class_TypeVarTuple[*DefaultTs]]", not "type[Class_TypeVarTuple[str, int]]" [assert-type] generics_defaults.py:107: error: TypeVar default must be a subtype of the bound type [misc] generics_defaults.py:114: error: TypeVar default must be one of the constraint types [misc] -generics_defaults.py:131: error: Expression is of type "int", not "Any" [assert-type] -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] -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:132: error: Expression is of type "int", not "Any" [assert-type] +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] -generics_defaults.py:170: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [assert-type] +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] +generics_defaults.py:171: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [assert-type] """ conformance_automated = "Fail" errors_diff = """ -Line 142: Expected 1 errors +Line 143: Expected 1 errors Line 30: Unexpected errors ['generics_defaults.py:30: error: Expression is of type "type[NoNonDefaults[DefaultStrT, DefaultIntT]]", not "type[NoNonDefaults[str, int]]" [assert-type]'] Line 31: Unexpected errors ['generics_defaults.py:31: error: Expression is of type "type[NoNonDefaults[str, DefaultIntT]]", not "type[NoNonDefaults[str, int]]" [assert-type]'] 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 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]'] 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]'] 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]'] -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]'] -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]'] -Line 170: Unexpected errors ['generics_defaults.py:170: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [assert-type]'] +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]'] +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]'] +Line 171: Unexpected errors ['generics_defaults.py:171: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [assert-type]'] """ diff --git a/conformance/results/mypy/generics_self_basic.toml b/conformance/results/mypy/generics_self_basic.toml index c902871c..2502d0de 100644 --- a/conformance/results/mypy/generics_self_basic.toml +++ b/conformance/results/mypy/generics_self_basic.toml @@ -2,7 +2,7 @@ conformant = "Pass" output = """ generics_self_basic.py:20: error: Incompatible return value type (got "Shape", expected "Self") [return-value] generics_self_basic.py:33: error: Incompatible return value type (got "Shape", expected "Self") [return-value] -generics_self_basic.py:67: error: Self type cannot have type arguments [misc] +generics_self_basic.py:68: error: Self type cannot have type arguments [misc] """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/mypy/generics_self_usage.toml b/conformance/results/mypy/generics_self_usage.toml index 32b70b84..b1385253 100644 --- a/conformance/results/mypy/generics_self_usage.toml +++ b/conformance/results/mypy/generics_self_usage.toml @@ -5,17 +5,17 @@ generics_self_usage.py:76: error: Self type is only allowed in annotations withi generics_self_usage.py:82: error: Method cannot have explicit self annotation and Self type [misc] generics_self_usage.py:82: error: A function returning TypeVar should receive at least one argument containing the same TypeVar [type-var] generics_self_usage.py:82: note: Consider using the upper bound "Foo2" instead -generics_self_usage.py:86: error: Incompatible return value type (got "Foo3", expected "Self") [return-value] -generics_self_usage.py:101: error: Self type is only allowed in annotations within class definition [misc] +generics_self_usage.py:87: error: Incompatible return value type (got "Foo3", expected "Self") [return-value] generics_self_usage.py:103: error: Self type is only allowed in annotations within class definition [misc] -generics_self_usage.py:106: error: Self type is only allowed in annotations within class definition [misc] -generics_self_usage.py:106: error: Self type cannot be used in type alias target [misc] -generics_self_usage.py:111: error: Static methods cannot use Self type [misc] -generics_self_usage.py:111: error: A function returning TypeVar should receive at least one argument containing the same TypeVar [type-var] -generics_self_usage.py:111: note: Consider using the upper bound "Base" instead -generics_self_usage.py:116: error: Static methods cannot use Self type [misc] -generics_self_usage.py:121: error: Self type cannot be used in a metaclass [misc] -generics_self_usage.py:125: error: Self type cannot be used in a metaclass [misc] +generics_self_usage.py:105: error: Self type is only allowed in annotations within class definition [misc] +generics_self_usage.py:108: error: Self type is only allowed in annotations within class definition [misc] +generics_self_usage.py:108: error: Self type cannot be used in type alias target [misc] +generics_self_usage.py:113: error: Static methods cannot use Self type [misc] +generics_self_usage.py:113: error: A function returning TypeVar should receive at least one argument containing the same TypeVar [type-var] +generics_self_usage.py:113: note: Consider using the upper bound "Base" instead +generics_self_usage.py:118: error: Static methods cannot use Self type [misc] +generics_self_usage.py:123: error: Self type cannot be used in a metaclass [misc] +generics_self_usage.py:127: error: Self type cannot be used in a metaclass [misc] """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/mypy/overloads_definitions.toml b/conformance/results/mypy/overloads_definitions.toml index 82730d4f..80b29a62 100644 --- a/conformance/results/mypy/overloads_definitions.toml +++ b/conformance/results/mypy/overloads_definitions.toml @@ -4,7 +4,7 @@ notes = """ Allows @override to be on all overloads and implementation, instead of just implementation. """ errors_diff = """ -Lines 220, 221, 222, 225, 226: Expected error (tag 'override_impl') +Lines 226, 227, 228, 231, 232: Expected error (tag 'override_impl') """ output = """ overloads_definitions.py:15: error: Single overload definition, multiple required [misc] @@ -12,8 +12,8 @@ overloads_definitions.py:27: error: An overloaded function outside a stub file m overloads_definitions.py:58: error: An overloaded function outside a stub file must have an implementation [no-overload-impl] overloads_definitions.py:71: error: Overload does not consistently use the "@staticmethod" decorator on all function signatures. [misc] overloads_definitions.py:84: error: Overload does not consistently use the "@classmethod" decorator on all function signatures. [misc] -overloads_definitions.py:121: error: @final should be applied only to overload implementation [misc] -overloads_definitions.py:135: error: @final should be applied only to overload implementation [misc] -overloads_definitions.py:175: error: Cannot override final attribute "final_method" (previously declared in base class "Base") [misc] -overloads_definitions.py:190: error: Method "bad_override" is marked as an override, but no base method was found with this name [misc] +overloads_definitions.py:122: error: @final should be applied only to overload implementation [misc] +overloads_definitions.py:137: error: @final should be applied only to overload implementation [misc] +overloads_definitions.py:180: error: Cannot override final attribute "final_method" (previously declared in base class "Base") [misc] +overloads_definitions.py:195: error: Method "bad_override" is marked as an override, but no base method was found with this name [misc] """ diff --git a/conformance/results/mypy/overloads_evaluation.toml b/conformance/results/mypy/overloads_evaluation.toml index 91b04235..4ddeaca2 100644 --- a/conformance/results/mypy/overloads_evaluation.toml +++ b/conformance/results/mypy/overloads_evaluation.toml @@ -8,16 +8,16 @@ Evaluates Any in some cases where overload is not ambiguous. """ conformance_automated = "Fail" errors_diff = """ -Line 134: Unexpected errors ['overloads_evaluation.py:134: error: No overload variant of "expand_bool" matches argument type "bool" [call-overload]'] -Line 135: Unexpected errors ['overloads_evaluation.py:135: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type]'] -Line 160: Unexpected errors ['overloads_evaluation.py:160: error: No overload variant of "expand_enum" matches argument type "Color" [call-overload]'] -Line 161: Unexpected errors ['overloads_evaluation.py:161: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type]'] -Line 204: Unexpected errors ['overloads_evaluation.py:204: error: Argument 1 to "expand_tuple" has incompatible type "tuple[int, int | str]"; expected "tuple[int, int]" [arg-type]'] -Line 205: Unexpected errors ['overloads_evaluation.py:205: error: Expression is of type "int", not "int | str" [assert-type]'] -Line 264: Unexpected errors ['overloads_evaluation.py:264: error: Expression is of type "list[Any]", not "Any" [assert-type]'] -Line 280: Unexpected errors ['overloads_evaluation.py:280: error: Expression is of type "list[Any]", not "Any" [assert-type]'] -Line 301: Unexpected errors ['overloads_evaluation.py:301: error: Expression is of type "Any", not "float" [assert-type]'] -Line 345: Unexpected errors ['overloads_evaluation.py:345: error: Expression is of type "list[Any]", not "Any" [assert-type]'] +Line 135: Unexpected errors ['overloads_evaluation.py:135: error: No overload variant of "expand_bool" matches argument type "bool" [call-overload]'] +Line 136: Unexpected errors ['overloads_evaluation.py:136: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type]'] +Line 161: Unexpected errors ['overloads_evaluation.py:161: error: No overload variant of "expand_enum" matches argument type "Color" [call-overload]'] +Line 162: Unexpected errors ['overloads_evaluation.py:162: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type]'] +Line 205: Unexpected errors ['overloads_evaluation.py:205: error: Argument 1 to "expand_tuple" has incompatible type "tuple[int, int | str]"; expected "tuple[int, int]" [arg-type]'] +Line 206: Unexpected errors ['overloads_evaluation.py:206: error: Expression is of type "int", not "int | str" [assert-type]'] +Line 265: Unexpected errors ['overloads_evaluation.py:265: error: Expression is of type "list[Any]", not "Any" [assert-type]'] +Line 281: Unexpected errors ['overloads_evaluation.py:281: error: Expression is of type "list[Any]", not "Any" [assert-type]'] +Line 303: Unexpected errors ['overloads_evaluation.py:303: error: Expression is of type "Any", not "float" [assert-type]'] +Line 347: Unexpected errors ['overloads_evaluation.py:347: error: Expression is of type "list[Any]", not "Any" [assert-type]'] """ output = """ overloads_evaluation.py:38: error: All overload variants of "example1_1" require at least one argument [call-overload] @@ -32,22 +32,22 @@ overloads_evaluation.py:51: error: No overload variant of "example1_1" matches a overloads_evaluation.py:51: note: Possible overload variants: overloads_evaluation.py:51: note: def example1_1(x: int, y: str) -> int overloads_evaluation.py:51: note: def example1_1(x: str) -> str -overloads_evaluation.py:115: error: Argument 1 to "example2" has incompatible type "int | str"; expected "int" [arg-type] -overloads_evaluation.py:115: error: Argument 2 to "example2" has incompatible type "int | str"; expected "str" [arg-type] -overloads_evaluation.py:134: error: No overload variant of "expand_bool" matches argument type "bool" [call-overload] -overloads_evaluation.py:134: note: Possible overload variants: -overloads_evaluation.py:134: note: def expand_bool(x: Literal[False]) -> Literal[0] -overloads_evaluation.py:134: note: def expand_bool(x: Literal[True]) -> Literal[1] -overloads_evaluation.py:135: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type] -overloads_evaluation.py:160: error: No overload variant of "expand_enum" matches argument type "Color" [call-overload] -overloads_evaluation.py:160: note: Possible overload variants: -overloads_evaluation.py:160: note: def expand_enum(x: Literal[Color.RED]) -> Literal[0] -overloads_evaluation.py:160: note: def expand_enum(x: Literal[Color.BLUE]) -> Literal[1] -overloads_evaluation.py:161: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type] -overloads_evaluation.py:204: error: Argument 1 to "expand_tuple" has incompatible type "tuple[int, int | str]"; expected "tuple[int, int]" [arg-type] -overloads_evaluation.py:205: error: Expression is of type "int", not "int | str" [assert-type] -overloads_evaluation.py:264: error: Expression is of type "list[Any]", not "Any" [assert-type] -overloads_evaluation.py:280: error: Expression is of type "list[Any]", not "Any" [assert-type] -overloads_evaluation.py:301: error: Expression is of type "Any", not "float" [assert-type] -overloads_evaluation.py:345: error: Expression is of type "list[Any]", not "Any" [assert-type] +overloads_evaluation.py:116: error: Argument 1 to "example2" has incompatible type "int | str"; expected "int" [arg-type] +overloads_evaluation.py:116: error: Argument 2 to "example2" has incompatible type "int | str"; expected "str" [arg-type] +overloads_evaluation.py:135: error: No overload variant of "expand_bool" matches argument type "bool" [call-overload] +overloads_evaluation.py:135: note: Possible overload variants: +overloads_evaluation.py:135: note: def expand_bool(x: Literal[False]) -> Literal[0] +overloads_evaluation.py:135: note: def expand_bool(x: Literal[True]) -> Literal[1] +overloads_evaluation.py:136: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type] +overloads_evaluation.py:161: error: No overload variant of "expand_enum" matches argument type "Color" [call-overload] +overloads_evaluation.py:161: note: Possible overload variants: +overloads_evaluation.py:161: note: def expand_enum(x: Literal[Color.RED]) -> Literal[0] +overloads_evaluation.py:161: note: def expand_enum(x: Literal[Color.BLUE]) -> Literal[1] +overloads_evaluation.py:162: error: Expression is of type "Any", not "Literal[0, 1]" [assert-type] +overloads_evaluation.py:205: error: Argument 1 to "expand_tuple" has incompatible type "tuple[int, int | str]"; expected "tuple[int, int]" [arg-type] +overloads_evaluation.py:206: error: Expression is of type "int", not "int | str" [assert-type] +overloads_evaluation.py:265: error: Expression is of type "list[Any]", not "Any" [assert-type] +overloads_evaluation.py:281: error: Expression is of type "list[Any]", not "Any" [assert-type] +overloads_evaluation.py:303: error: Expression is of type "Any", not "float" [assert-type] +overloads_evaluation.py:347: error: Expression is of type "list[Any]", not "Any" [assert-type] """ diff --git a/conformance/results/pyrefly/constructors_call_new.toml b/conformance/results/pyrefly/constructors_call_new.toml index 690a7213..edef6e5e 100644 --- a/conformance/results/pyrefly/constructors_call_new.toml +++ b/conformance/results/pyrefly/constructors_call_new.toml @@ -4,5 +4,5 @@ errors_diff = """ """ output = """ ERROR constructors_call_new.py:21:13-16: Argument `float` is not assignable to parameter `x` with type `int` in function `Class1.__new__` [bad-argument-type] -ERROR constructors_call_new.py:145:13-15: Argument `type[Class11[str]]` is not assignable to parameter `cls` with type `type[Class11[int]]` in function `Class11.__new__` [bad-argument-type] +ERROR constructors_call_new.py:148:13-15: Argument `type[Class11[str]]` is not assignable to parameter `cls` with type `type[Class11[int]]` in function `Class11.__new__` [bad-argument-type] """ diff --git a/conformance/results/pyrefly/constructors_callable.toml b/conformance/results/pyrefly/constructors_callable.toml index bbfb662d..d3200470 100644 --- a/conformance/results/pyrefly/constructors_callable.toml +++ b/conformance/results/pyrefly/constructors_callable.toml @@ -6,29 +6,29 @@ Converting constructor to callable uses __new__ signature instead of __init__ """ conformance_automated = "Fail" errors_diff = """ -Line 65: Expected 1 errors Line 66: Expected 1 errors Line 67: Expected 1 errors -Line 184: Expected 1 errors -Line 195: Expected 1 errors -Line 62: Unexpected errors ['Argument `type[Class3]` is not assignable to parameter `cb` with type `(*args: Unknown, **kwargs: Unknown) -> Class3` in function `accepts_callable` [bad-argument-type]'] -Line 164: Unexpected errors ['assert_type(Class7[Any], Class7[int]) failed [assert-type]'] -Line 165: Unexpected errors ['assert_type(Class7[Any], Class7[str]) failed [assert-type]', "Argument `Literal['']` is not assignable to parameter `x` with type `int` [bad-argument-type]"] -Line 183: Unexpected errors ['assert_type(Class8[Any], Class8[str]) failed [assert-type]'] +Line 68: Expected 1 errors +Line 186: Expected 1 errors +Line 197: Expected 1 errors +Line 63: Unexpected errors ['Argument `type[Class3]` is not assignable to parameter `cb` with type `(*args: Unknown, **kwargs: Unknown) -> Class3` in function `accepts_callable` [bad-argument-type]'] +Line 166: Unexpected errors ['assert_type(Class7[Any], Class7[int]) failed [assert-type]'] +Line 167: Unexpected errors ['assert_type(Class7[Any], Class7[str]) failed [assert-type]', "Argument `Literal['']` is not assignable to parameter `x` with type `int` [bad-argument-type]"] +Line 185: Unexpected errors ['assert_type(Class8[Any], Class8[str]) failed [assert-type]'] """ output = """ ERROR constructors_callable.py:38:3-5: Missing argument `x` [missing-argument] ERROR constructors_callable.py:39:3-8: Missing argument `x` [missing-argument] ERROR constructors_callable.py:39:4-5: Unexpected keyword argument `y` [unexpected-keyword] ERROR constructors_callable.py:51:4-5: Expected 0 positional arguments, got 1 [bad-argument-count] -ERROR constructors_callable.py:62:23-29: Argument `type[Class3]` is not assignable to parameter `cb` with type `(*args: Unknown, **kwargs: Unknown) -> Class3` in function `accepts_callable` [bad-argument-type] -ERROR constructors_callable.py:79:3-5: Missing argument `x` [missing-argument] -ERROR constructors_callable.py:80:3-8: Missing argument `x` [missing-argument] -ERROR constructors_callable.py:80:4-5: Unexpected keyword argument `y` [unexpected-keyword] -ERROR constructors_callable.py:127:4-5: Expected 0 positional arguments, got 1 [bad-argument-count] -ERROR constructors_callable.py:144:8-9: Expected 0 positional arguments, got 1 [bad-argument-count] -ERROR constructors_callable.py:164:12-32: assert_type(Class7[Any], Class7[int]) failed [assert-type] -ERROR constructors_callable.py:165:12-33: assert_type(Class7[Any], Class7[str]) failed [assert-type] -ERROR constructors_callable.py:165:16-18: Argument `Literal['']` is not assignable to parameter `x` with type `int` [bad-argument-type] -ERROR constructors_callable.py:183:12-41: assert_type(Class8[Any], Class8[str]) failed [assert-type] +ERROR constructors_callable.py:63:23-29: Argument `type[Class3]` is not assignable to parameter `cb` with type `(*args: Unknown, **kwargs: Unknown) -> Class3` in function `accepts_callable` [bad-argument-type] +ERROR constructors_callable.py:81:3-5: Missing argument `x` [missing-argument] +ERROR constructors_callable.py:82:3-8: Missing argument `x` [missing-argument] +ERROR constructors_callable.py:82:4-5: Unexpected keyword argument `y` [unexpected-keyword] +ERROR constructors_callable.py:129:4-5: Expected 0 positional arguments, got 1 [bad-argument-count] +ERROR constructors_callable.py:146:8-9: Expected 0 positional arguments, got 1 [bad-argument-count] +ERROR constructors_callable.py:166:12-32: assert_type(Class7[Any], Class7[int]) failed [assert-type] +ERROR constructors_callable.py:167:12-33: assert_type(Class7[Any], Class7[str]) failed [assert-type] +ERROR constructors_callable.py:167:16-18: Argument `Literal['']` is not assignable to parameter `x` with type `int` [bad-argument-type] +ERROR constructors_callable.py:185:12-41: assert_type(Class8[Any], Class8[str]) failed [assert-type] """ diff --git a/conformance/results/pyrefly/generics_defaults.toml b/conformance/results/pyrefly/generics_defaults.toml index 2bef8963..8589ad52 100644 --- a/conformance/results/pyrefly/generics_defaults.toml +++ b/conformance/results/pyrefly/generics_defaults.toml @@ -4,14 +4,14 @@ Defaults are not bound by attribute access """ conformance_automated = "Fail" errors_diff = """ -Line 170: Unexpected errors ['assert_type([DefaultIntT](Foo7[DefaultIntT]) -> Foo7[DefaultIntT], (Foo7[int]) -> Foo7[int]) failed [assert-type]'] +Line 171: Unexpected errors ['assert_type([DefaultIntT](Foo7[DefaultIntT]) -> Foo7[DefaultIntT], (Foo7[int]) -> Foo7[int]) failed [assert-type]'] """ output = """ ERROR generics_defaults.py:24:7-31: Type parameter `T` without a default cannot follow type parameter `DefaultStrT` with a default [invalid-type-var] ERROR generics_defaults.py:50:1-20: Expected 5 type arguments for `AllTheDefaults`, got 1 [bad-specialization] ERROR generics_defaults.py:107:51-54: Expected default `int` of `Invalid1` to be assignable to the upper bound of `str` [invalid-type-var] ERROR generics_defaults.py:114:52-55: Expected default `int` of `Invalid2` to be one of the following constraints: `float`, `str` [invalid-type-var] -ERROR generics_defaults.py:131:12-27: assert_type(int, Any) failed [assert-type] -ERROR generics_defaults.py:142:7-11: TypeVar `T5` with a default cannot follow TypeVarTuple `Ts` [invalid-type-var] -ERROR generics_defaults.py:170:12-57: assert_type([DefaultIntT](Foo7[DefaultIntT]) -> Foo7[DefaultIntT], (Foo7[int]) -> Foo7[int]) failed [assert-type] +ERROR generics_defaults.py:132:12-27: assert_type(int, Any) failed [assert-type] +ERROR generics_defaults.py:143:7-11: TypeVar `T5` with a default cannot follow TypeVarTuple `Ts` [invalid-type-var] +ERROR generics_defaults.py:171:12-57: assert_type([DefaultIntT](Foo7[DefaultIntT]) -> Foo7[DefaultIntT], (Foo7[int]) -> Foo7[int]) failed [assert-type] """ diff --git a/conformance/results/pyrefly/generics_self_basic.toml b/conformance/results/pyrefly/generics_self_basic.toml index 0e72344d..7f9b03ea 100644 --- a/conformance/results/pyrefly/generics_self_basic.toml +++ b/conformance/results/pyrefly/generics_self_basic.toml @@ -8,5 +8,5 @@ Line 20: Expected 1 errors Line 33: Expected 1 errors """ output = """ -ERROR generics_self_basic.py:67:26-35: `type[Self@Container]` is not subscriptable [unsupported-operation] +ERROR generics_self_basic.py:68:26-35: `type[Self@Container]` is not subscriptable [unsupported-operation] """ diff --git a/conformance/results/pyrefly/generics_self_usage.toml b/conformance/results/pyrefly/generics_self_usage.toml index 44c8b560..fc359e78 100644 --- a/conformance/results/pyrefly/generics_self_usage.toml +++ b/conformance/results/pyrefly/generics_self_usage.toml @@ -7,14 +7,14 @@ errors_diff = """ Line 73: Expected 1 errors Line 76: Expected 1 errors Line 82: Expected 1 errors -Line 86: Expected 1 errors -Line 101: Expected 1 errors -Line 106: Expected 1 errors -Line 111: Expected 1 errors -Line 116: Expected 1 errors -Line 121: Expected 1 errors -Line 125: Expected 1 errors +Line 87: Expected 1 errors +Line 103: Expected 1 errors +Line 108: Expected 1 errors +Line 113: Expected 1 errors +Line 118: Expected 1 errors +Line 123: Expected 1 errors +Line 127: Expected 1 errors """ output = """ -ERROR generics_self_usage.py:103:12-16: Invalid base class: `Self` [invalid-inheritance] +ERROR generics_self_usage.py:105:12-16: Invalid base class: `Self` [invalid-inheritance] """ diff --git a/conformance/results/pyrefly/overloads_definitions.toml b/conformance/results/pyrefly/overloads_definitions.toml index 6894d760..4c793b5c 100644 --- a/conformance/results/pyrefly/overloads_definitions.toml +++ b/conformance/results/pyrefly/overloads_definitions.toml @@ -8,11 +8,11 @@ ERROR overloads_definitions.py:59:9-21: Overloaded function must have an impleme ERROR overloads_definitions.py:81:9-14: If `@staticmethod` is present on any overload or the implementation, it should be on every overload and the implementation. [invalid-overload] ERROR overloads_definitions.py:90:9-14: If `@classmethod` is present on any overload or the implementation, it should be on every overload and the implementation. [invalid-overload] ERROR overloads_definitions.py:90:9-14: Implementation signature `(cls: type[Self@C], *args: int | str) -> int | str` does not accept all arguments that overload signature `(self: Self@C, x: str, /) -> str` accepts [inconsistent-overload] -ERROR overloads_definitions.py:123:9-22: `@final` should only be applied to the implementation of an overloaded function. [invalid-overload] -ERROR overloads_definitions.py:137:9-24: `@final` should only be applied to the implementation of an overloaded function. [invalid-overload] -ERROR overloads_definitions.py:142:9-24: `@final` should only be applied to the implementation of an overloaded function. [invalid-overload] -ERROR overloads_definitions.py:176:9-21: `final_method` is declared as final in parent class `Base` [bad-override] -ERROR overloads_definitions.py:191:9-21: Class member `Child.bad_override` is marked as an override, but no parent class has a matching attribute [bad-override] -ERROR overloads_definitions.py:222:9-20: `@override` should only be applied to the implementation of an overloaded function. [invalid-overload] -ERROR overloads_definitions.py:226:9-20: `@override` should only be applied to the implementation of an overloaded function. [invalid-overload] +ERROR overloads_definitions.py:124:9-22: `@final` should only be applied to the implementation of an overloaded function. [invalid-overload] +ERROR overloads_definitions.py:139:9-24: `@final` should only be applied to the implementation of an overloaded function. [invalid-overload] +ERROR overloads_definitions.py:144:9-24: `@final` should only be applied to the implementation of an overloaded function. [invalid-overload] +ERROR overloads_definitions.py:181:9-21: `final_method` is declared as final in parent class `Base` [bad-override] +ERROR overloads_definitions.py:196:9-21: Class member `Child.bad_override` is marked as an override, but no parent class has a matching attribute [bad-override] +ERROR overloads_definitions.py:228:9-20: `@override` should only be applied to the implementation of an overloaded function. [invalid-overload] +ERROR overloads_definitions.py:232:9-20: `@override` should only be applied to the implementation of an overloaded function. [invalid-overload] """ diff --git a/conformance/results/pyrefly/overloads_evaluation.toml b/conformance/results/pyrefly/overloads_evaluation.toml index c1431c34..46549b26 100644 --- a/conformance/results/pyrefly/overloads_evaluation.toml +++ b/conformance/results/pyrefly/overloads_evaluation.toml @@ -5,5 +5,5 @@ output = """ ERROR overloads_evaluation.py:38:11-13: No matching overload found for function `example1_1` called with arguments: () [no-matching-overload] ERROR overloads_evaluation.py:46:11-17: No matching overload found for function `example1_1` called with arguments: (Literal[1], Literal[1]) [no-matching-overload] ERROR overloads_evaluation.py:51:11-14: No matching overload found for function `example1_1` called with arguments: (Literal[1]) [no-matching-overload] -ERROR overloads_evaluation.py:115:13-22: No matching overload found for function `example2` called with arguments: (int | str, int | str, Literal[1]) [no-matching-overload] +ERROR overloads_evaluation.py:116:13-22: No matching overload found for function `example2` called with arguments: (int | str, int | str, Literal[1]) [no-matching-overload] """ diff --git a/conformance/results/pyright/constructors_call_new.toml b/conformance/results/pyright/constructors_call_new.toml index 1585d37d..e2387d4f 100644 --- a/conformance/results/pyright/constructors_call_new.toml +++ b/conformance/results/pyright/constructors_call_new.toml @@ -4,7 +4,7 @@ errors_diff = """ output = """ constructors_call_new.py:21:13 - error: Argument of type "float" cannot be assigned to parameter "x" of type "int" in function "__new__"   "float" is not assignable to "int" (reportArgumentType) -constructors_call_new.py:145:1 - error: +constructors_call_new.py:148:1 - error:   Could not bind method "__new__" because "type[Class11[str]]" is not assignable to parameter "cls"     "type[Class11[str]]" is not assignable to "type[Class11[int]]"     Type "type[Class11[str]]" is not assignable to type "type[Class11[int]]" diff --git a/conformance/results/pyright/constructors_callable.toml b/conformance/results/pyright/constructors_callable.toml index 708e4555..4a9c41d5 100644 --- a/conformance/results/pyright/constructors_callable.toml +++ b/conformance/results/pyright/constructors_callable.toml @@ -9,25 +9,25 @@ constructors_callable.py:39:1 - error: Argument missing for parameter "x" (repor constructors_callable.py:39:4 - error: No parameter named "y" (reportCallIssue) constructors_callable.py:49:13 - information: Type of "r2" is "() -> Class2" constructors_callable.py:51:4 - error: Expected 0 positional arguments (reportCallIssue) -constructors_callable.py:63:13 - information: Type of "r3" is "(x: int) -> Class3" -constructors_callable.py:65:1 - error: Argument missing for parameter "x" (reportCallIssue) +constructors_callable.py:64:13 - information: Type of "r3" is "(x: int) -> Class3" constructors_callable.py:66:1 - error: Argument missing for parameter "x" (reportCallIssue) -constructors_callable.py:66:4 - error: No parameter named "y" (reportCallIssue) -constructors_callable.py:67:7 - error: Expected 1 positional argument (reportCallIssue) -constructors_callable.py:77:13 - information: Type of "r4" is "(x: int) -> int" -constructors_callable.py:79:1 - error: Argument missing for parameter "x" (reportCallIssue) -constructors_callable.py:80:1 - error: Argument missing for parameter "x" (reportCallIssue) -constructors_callable.py:80:4 - error: No parameter named "y" (reportCallIssue) -constructors_callable.py:97:13 - information: Type of "r5" is "(...) -> NoReturn" -constructors_callable.py:125:13 - information: Type of "r6" is "() -> Class6Proxy" -constructors_callable.py:127:4 - error: Expected 0 positional arguments (reportCallIssue) -constructors_callable.py:142:13 - information: Type of "r6_any" is "() -> Any" -constructors_callable.py:144:8 - error: Expected 0 positional arguments (reportCallIssue) -constructors_callable.py:162:5 - information: Type of "r7" is "Overload[(x: int) -> Class7[int], (x: str) -> Class7[str]]" -constructors_callable.py:182:13 - information: Type of "r8" is "(x: list[T@Class8], y: list[T@Class8]) -> Class8[T@Class8]" -constructors_callable.py:184:10 - error: Argument of type "list[str]" cannot be assigned to parameter "y" of type "list[T@Class8]" +constructors_callable.py:67:1 - error: Argument missing for parameter "x" (reportCallIssue) +constructors_callable.py:67:4 - error: No parameter named "y" (reportCallIssue) +constructors_callable.py:68:7 - error: Expected 1 positional argument (reportCallIssue) +constructors_callable.py:79:13 - information: Type of "r4" is "(x: int) -> int" +constructors_callable.py:81:1 - error: Argument missing for parameter "x" (reportCallIssue) +constructors_callable.py:82:1 - error: Argument missing for parameter "x" (reportCallIssue) +constructors_callable.py:82:4 - error: No parameter named "y" (reportCallIssue) +constructors_callable.py:99:13 - information: Type of "r5" is "(...) -> NoReturn" +constructors_callable.py:127:13 - information: Type of "r6" is "() -> Class6Proxy" +constructors_callable.py:129:4 - error: Expected 0 positional arguments (reportCallIssue) +constructors_callable.py:144:13 - information: Type of "r6_any" is "() -> Any" +constructors_callable.py:146:8 - error: Expected 0 positional arguments (reportCallIssue) +constructors_callable.py:164:5 - information: Type of "r7" is "Overload[(x: int) -> Class7[int], (x: str) -> Class7[str]]" +constructors_callable.py:184:13 - information: Type of "r8" is "(x: list[T@Class8], y: list[T@Class8]) -> Class8[T@Class8]" +constructors_callable.py:186:10 - error: Argument of type "list[str]" cannot be assigned to parameter "y" of type "list[T@Class8]"   "Literal['']" is not assignable to "int" (reportArgumentType) -constructors_callable.py:193:13 - information: Type of "r9" is "(x: list[T@__init__], y: list[T@__init__]) -> Class9" -constructors_callable.py:195:10 - error: Argument of type "list[str]" cannot be assigned to parameter "y" of type "list[T@__init__]" +constructors_callable.py:195:13 - information: Type of "r9" is "(x: list[T@__init__], y: list[T@__init__]) -> Class9" +constructors_callable.py:197:10 - error: Argument of type "list[str]" cannot be assigned to parameter "y" of type "list[T@__init__]"   "Literal['']" is not assignable to "int" (reportArgumentType) """ diff --git a/conformance/results/pyright/generics_defaults.toml b/conformance/results/pyright/generics_defaults.toml index 55f1dd65..35fdac0c 100644 --- a/conformance/results/pyright/generics_defaults.toml +++ b/conformance/results/pyright/generics_defaults.toml @@ -4,8 +4,8 @@ generics_defaults.py:24:7 - error: "T" cannot appear after "DefaultStrT" in type generics_defaults.py:50:16 - error: Too few type arguments provided for "AllTheDefaults"; expected 2 but received 1 (reportInvalidTypeArguments) generics_defaults.py:107:51 - error: TypeVar default type must be a subtype of the bound type (reportGeneralTypeIssues) generics_defaults.py:114:52 - error: TypeVar default type must be one of the constrained types (reportGeneralTypeIssues) -generics_defaults.py:131:13 - error: "assert_type" mismatch: expected "Any" but received "int" (reportAssertTypeFailure) -generics_defaults.py:142:7 - error: TypeVar "T5" has a default value and cannot follow TypeVarTuple "Ts" (reportGeneralTypeIssues) +generics_defaults.py:132:13 - error: "assert_type" mismatch: expected "Any" but received "int" (reportAssertTypeFailure) +generics_defaults.py:143:7 - error: TypeVar "T5" has a default value and cannot follow TypeVarTuple "Ts" (reportGeneralTypeIssues) """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/pyright/generics_self_basic.toml b/conformance/results/pyright/generics_self_basic.toml index 6ce2caef..6b1dc6c5 100644 --- a/conformance/results/pyright/generics_self_basic.toml +++ b/conformance/results/pyright/generics_self_basic.toml @@ -4,7 +4,7 @@ generics_self_basic.py:20:16 - error: Type "Shape" is not assignable to return t   Type "Shape" is not assignable to type "Self@Shape" (reportReturnType) generics_self_basic.py:33:16 - error: Type "Shape" is not assignable to return type "Self@Shape"   Type "Shape" is not assignable to type "Self@Shape" (reportReturnType) -generics_self_basic.py:67:31 - error: Expected no type arguments for class "Self" (reportInvalidTypeArguments) +generics_self_basic.py:68:31 - error: Expected no type arguments for class "Self" (reportInvalidTypeArguments) """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/pyright/generics_self_usage.toml b/conformance/results/pyright/generics_self_usage.toml index 95f5ac1a..b3b60961 100644 --- a/conformance/results/pyright/generics_self_usage.toml +++ b/conformance/results/pyright/generics_self_usage.toml @@ -6,16 +6,16 @@ generics_self_usage.py:76:6 - error: "Self" is not valid in this context (report generics_self_usage.py:82:44 - warning: TypeVar "TFoo2" appears only once in generic function signature   Use "Foo2" instead (reportInvalidTypeVarUse) generics_self_usage.py:82:54 - error: "Self" cannot be used in a function with a `self` or `cls` parameter that has a type annotation other than "Self" (reportGeneralTypeIssues) -generics_self_usage.py:86:16 - error: Type "Foo3" is not assignable to return type "Self@Foo3" +generics_self_usage.py:87:16 - error: Type "Foo3" is not assignable to return type "Self@Foo3"   Type "Foo3" is not assignable to type "Self@Foo3" (reportReturnType) -generics_self_usage.py:101:15 - error: "Self" is not valid in this context (reportGeneralTypeIssues) -generics_self_usage.py:103:12 - error: "Self" is not valid in this context (reportGeneralTypeIssues) -generics_self_usage.py:106:30 - error: "Self" is not valid in this context (reportGeneralTypeIssues) -generics_self_usage.py:111:19 - error: "Self" is not valid in this context (reportGeneralTypeIssues) -generics_self_usage.py:116:31 - error: "Self" is not valid in this context (reportGeneralTypeIssues) -generics_self_usage.py:116:40 - error: "Self" is not valid in this context (reportGeneralTypeIssues) -generics_self_usage.py:121:37 - error: "Self" cannot be used within a metaclass (a subclass of "type") (reportGeneralTypeIssues) -generics_self_usage.py:125:42 - error: "Self" cannot be used within a metaclass (a subclass of "type") (reportGeneralTypeIssues) +generics_self_usage.py:103:15 - error: "Self" is not valid in this context (reportGeneralTypeIssues) +generics_self_usage.py:105:12 - error: "Self" is not valid in this context (reportGeneralTypeIssues) +generics_self_usage.py:108:30 - error: "Self" is not valid in this context (reportGeneralTypeIssues) +generics_self_usage.py:113:19 - error: "Self" is not valid in this context (reportGeneralTypeIssues) +generics_self_usage.py:118:31 - error: "Self" is not valid in this context (reportGeneralTypeIssues) +generics_self_usage.py:118:40 - error: "Self" is not valid in this context (reportGeneralTypeIssues) +generics_self_usage.py:123:37 - error: "Self" cannot be used within a metaclass (a subclass of "type") (reportGeneralTypeIssues) +generics_self_usage.py:127:42 - error: "Self" cannot be used within a metaclass (a subclass of "type") (reportGeneralTypeIssues) """ conformance_automated = "Pass" errors_diff = """ diff --git a/conformance/results/pyright/overloads_definitions.toml b/conformance/results/pyright/overloads_definitions.toml index f7b17e78..e6118e2a 100644 --- a/conformance/results/pyright/overloads_definitions.toml +++ b/conformance/results/pyright/overloads_definitions.toml @@ -8,11 +8,11 @@ overloads_definitions.py:28:5 - error: "func2" is marked as overload, but no imp overloads_definitions.py:59:9 - error: "not_abstract" is marked as overload, but no implementation is provided (reportNoOverloadImplementation) overloads_definitions.py:73:9 - error: Overloads for "func5" use @staticmethod inconsistently (reportInconsistentOverload) overloads_definitions.py:86:9 - error: Overloads for "func6" use @classmethod inconsistently (reportInconsistentOverload) -overloads_definitions.py:123:9 - error: @final decorator should be applied only to the implementation (reportInconsistentOverload) -overloads_definitions.py:137:9 - error: @final decorator should be applied only to the implementation (reportInconsistentOverload) -overloads_definitions.py:142:9 - error: @final decorator should be applied only to the implementation (reportInconsistentOverload) -overloads_definitions.py:181:9 - error: Method "final_method" cannot override final method defined in class "Base" (reportIncompatibleMethodOverride) -overloads_definitions.py:198:9 - error: Method "bad_override" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) -overloads_definitions.py:222:9 - error: @override decorator should be applied only to the implementation (reportInconsistentOverload) -overloads_definitions.py:226:9 - error: @override decorator should be applied only to the implementation (reportInconsistentOverload) +overloads_definitions.py:124:9 - error: @final decorator should be applied only to the implementation (reportInconsistentOverload) +overloads_definitions.py:139:9 - error: @final decorator should be applied only to the implementation (reportInconsistentOverload) +overloads_definitions.py:144:9 - error: @final decorator should be applied only to the implementation (reportInconsistentOverload) +overloads_definitions.py:186:9 - error: Method "final_method" cannot override final method defined in class "Base" (reportIncompatibleMethodOverride) +overloads_definitions.py:203:9 - error: Method "bad_override" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) +overloads_definitions.py:228:9 - error: @override decorator should be applied only to the implementation (reportInconsistentOverload) +overloads_definitions.py:232:9 - error: @override decorator should be applied only to the implementation (reportInconsistentOverload) """ diff --git a/conformance/results/pyright/overloads_evaluation.toml b/conformance/results/pyright/overloads_evaluation.toml index 7f7e0dce..7b41dc4e 100644 --- a/conformance/results/pyright/overloads_evaluation.toml +++ b/conformance/results/pyright/overloads_evaluation.toml @@ -4,7 +4,7 @@ Does not evaluate Any in some cases where overload is ambiguous. """ conformance_automated = "Fail" errors_diff = """ -Line 280: Unexpected errors ['overloads_evaluation.py:280:17 - error: "assert_type" mismatch: expected "Any" but received "list[int]" (reportAssertTypeFailure)'] +Line 281: Unexpected errors ['overloads_evaluation.py:281:17 - error: "assert_type" mismatch: expected "Any" but received "list[int]" (reportAssertTypeFailure)'] """ output = """ overloads_evaluation.py:38:1 - error: No overloads for "example1_1" match the provided arguments @@ -13,12 +13,12 @@ overloads_evaluation.py:46:15 - error: Argument of type "Literal[1]" cannot be a   "Literal[1]" is not assignable to "str" (reportArgumentType) overloads_evaluation.py:51:12 - error: Argument of type "Literal[1]" cannot be assigned to parameter "x" of type "str" in function "example1_1"   "Literal[1]" is not assignable to "str" (reportArgumentType) -overloads_evaluation.py:115:5 - error: No overloads for "example2" match the provided arguments (reportCallIssue) -overloads_evaluation.py:115:14 - error: Argument of type "int | str" cannot be assigned to parameter "x" of type "int" in function "example2" +overloads_evaluation.py:116:5 - error: No overloads for "example2" match the provided arguments (reportCallIssue) +overloads_evaluation.py:116:14 - error: Argument of type "int | str" cannot be assigned to parameter "x" of type "int" in function "example2"   Type "int | str" is not assignable to type "int"     "str" is not assignable to "int" (reportArgumentType) -overloads_evaluation.py:115:17 - error: Argument of type "int | str" cannot be assigned to parameter "y" of type "int" in function "example2" +overloads_evaluation.py:116:17 - error: Argument of type "int | str" cannot be assigned to parameter "y" of type "int" in function "example2"   Type "int | str" is not assignable to type "int"     "str" is not assignable to "int" (reportArgumentType) -overloads_evaluation.py:280:17 - error: "assert_type" mismatch: expected "Any" but received "list[int]" (reportAssertTypeFailure) +overloads_evaluation.py:281:17 - error: "assert_type" mismatch: expected "Any" but received "list[int]" (reportAssertTypeFailure) """ diff --git a/conformance/results/results.html b/conformance/results/results.html index 22ac1d68..ec5fb551 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -378,7 +378,7 @@

Python Type System Conformance Test Results

Pass Pass Pass -
Partial

Fails to handle move_first_element_to_last example

+Pass      generics_typevartuple_overloads Pass @@ -573,7 +573,7 @@

Python Type System Conformance Test Results

Partial

Does not report unsafe overlap for runtime_checkable protocol.

Pass
Partial

Does not report unsafe overlap for runtime_checkable protocol.

-
Partial

Does not check for unsafe overlap in runtime_checkable protocols

+Pass      protocols_self Pass @@ -893,7 +893,7 @@

Python Type System Conformance Test Results

     tuples_type_compat
Partial

Does not support tuple narrowing based on `len()` type guard (optional).

Pass -
Partial

Incorrectly marks a match case as unreachable.

+Pass Pass      tuples_type_form diff --git a/conformance/results/zuban/constructors_call_new.toml b/conformance/results/zuban/constructors_call_new.toml index 3c94ad4e..12f5c828 100644 --- a/conformance/results/zuban/constructors_call_new.toml +++ b/conformance/results/zuban/constructors_call_new.toml @@ -6,7 +6,7 @@ Does not report errors during binding to cls parameter of __new__ method. """ conformance_automated = "Fail" errors_diff = """ -Line 145: Expected 1 errors +Line 148: Expected 1 errors 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]'] Line 49: Unexpected errors ['constructors_call_new.py:49: error: Expression is of type "Class3", not "int" [misc]', 'constructors_call_new.py:49: error: Missing positional argument "x" in call to "Class3" [call-arg]'] Line 57: Unexpected errors ['constructors_call_new.py:57: error: "__new__" must return a class instance (got "Class4 | Any") [misc]'] diff --git a/conformance/results/zuban/constructors_callable.toml b/conformance/results/zuban/constructors_callable.toml index f5e130ae..51b00c6f 100644 --- a/conformance/results/zuban/constructors_callable.toml +++ b/conformance/results/zuban/constructors_callable.toml @@ -7,16 +7,16 @@ Struggles with some cases of self types """ conformance_automated = "Fail" errors_diff = """ -Line 127: Expected 1 errors -Line 144: Expected 1 errors -Line 73: Unexpected errors ['constructors_callable.py:73: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "Class4") [misc]'] -Line 116: Unexpected errors ['constructors_callable.py:116: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc]'] -Line 126: Unexpected errors ['constructors_callable.py:126: error: Expression is of type "Class6", not "Class6Proxy" [misc]', 'constructors_callable.py:126: error: Missing positional argument "x" in call [call-arg]'] -Line 143: Unexpected errors ['constructors_callable.py:143: error: Expression is of type "Class6Any", not "Any" [misc]', 'constructors_callable.py:143: error: Missing positional argument "x" in call [call-arg]'] -Line 160: Unexpected errors ['constructors_callable.py:160: error: Need type annotation for "r7" [var-annotated]'] -Line 164: Unexpected errors ['constructors_callable.py:164: error: Expression is of type "Class7[Any]", not "Class7[int]" [misc]'] -Line 165: Unexpected errors ['constructors_callable.py:165: error: Expression is of type "Class7[Any]", not "Class7[str]" [misc]', 'constructors_callable.py:165: error: Argument 1 has incompatible type "str"; expected "int" [arg-type]'] -Line 194: Unexpected errors ['constructors_callable.py:194: error: List item 0 has incompatible type "str"; expected "T" [list-item]', 'constructors_callable.py:194: error: List item 0 has incompatible type "str"; expected "T" [list-item]'] +Line 129: Expected 1 errors +Line 146: Expected 1 errors +Line 74: Unexpected errors ['constructors_callable.py:74: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "Class4") [misc]'] +Line 118: Unexpected errors ['constructors_callable.py:118: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc]'] +Line 128: Unexpected errors ['constructors_callable.py:128: error: Expression is of type "Class6", not "Class6Proxy" [misc]', 'constructors_callable.py:128: error: Missing positional argument "x" in call [call-arg]'] +Line 145: Unexpected errors ['constructors_callable.py:145: error: Expression is of type "Class6Any", not "Any" [misc]', 'constructors_callable.py:145: error: Missing positional argument "x" in call [call-arg]'] +Line 162: Unexpected errors ['constructors_callable.py:162: error: Need type annotation for "r7" [var-annotated]'] +Line 166: Unexpected errors ['constructors_callable.py:166: error: Expression is of type "Class7[Any]", not "Class7[int]" [misc]'] +Line 167: Unexpected errors ['constructors_callable.py:167: error: Expression is of type "Class7[Any]", not "Class7[str]" [misc]', 'constructors_callable.py:167: error: Argument 1 has incompatible type "str"; expected "int" [arg-type]'] +Line 196: Unexpected errors ['constructors_callable.py:196: error: List item 0 has incompatible type "str"; expected "T" [list-item]', 'constructors_callable.py:196: error: List item 0 has incompatible type "str"; expected "T" [list-item]'] """ output = """ constructors_callable.py:36: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class1" @@ -24,32 +24,32 @@ constructors_callable.py:38: error: Missing positional argument "x" in call [ca constructors_callable.py:39: error: Unexpected keyword argument "y" [call-arg] constructors_callable.py:49: note: Revealed type is "def () -> constructors_callable.Class2" constructors_callable.py:51: error: Too many arguments [call-arg] -constructors_callable.py:63: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class3" -constructors_callable.py:65: error: Missing positional argument "x" in call [call-arg] -constructors_callable.py:66: error: Unexpected keyword argument "y" [call-arg] -constructors_callable.py:67: error: Too many arguments [call-arg] -constructors_callable.py:73: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "Class4") [misc] -constructors_callable.py:77: note: Revealed type is "def (x: builtins.int) -> builtins.int" -constructors_callable.py:79: error: Missing positional argument "x" in call [call-arg] -constructors_callable.py:80: error: Unexpected keyword argument "y" [call-arg] -constructors_callable.py:97: note: Revealed type is "def (*args: Any, **kwargs: Any) -> Never" -constructors_callable.py:116: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc] -constructors_callable.py:125: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class6" -constructors_callable.py:126: error: Expression is of type "Class6", not "Class6Proxy" [misc] -constructors_callable.py:126: error: Missing positional argument "x" in call [call-arg] -constructors_callable.py:142: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class6Any" -constructors_callable.py:143: error: Expression is of type "Class6Any", not "Any" [misc] -constructors_callable.py:143: error: Missing positional argument "x" in call [call-arg] -constructors_callable.py:160: error: Need type annotation for "r7" [var-annotated] -constructors_callable.py:162: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class7[Any]" -constructors_callable.py:164: error: Expression is of type "Class7[Any]", not "Class7[int]" [misc] -constructors_callable.py:165: error: Expression is of type "Class7[Any]", not "Class7[str]" [misc] -constructors_callable.py:165: error: Argument 1 has incompatible type "str"; expected "int" [arg-type] -constructors_callable.py:182: note: Revealed type is "def [T] (x: builtins.list[T], y: builtins.list[T]) -> constructors_callable.Class8[T]" -constructors_callable.py:184: error: List item 0 has incompatible type "str"; expected "int" [list-item] -constructors_callable.py:193: note: Revealed type is "def (x: builtins.list[T], y: builtins.list[T]) -> constructors_callable.Class9" -constructors_callable.py:194: error: List item 0 has incompatible type "str"; expected "T" [list-item] -constructors_callable.py:194: error: List item 0 has incompatible type "str"; expected "T" [list-item] -constructors_callable.py:195: error: List item 0 has incompatible type "int"; expected "T" [list-item] -constructors_callable.py:195: error: List item 0 has incompatible type "str"; expected "T" [list-item] +constructors_callable.py:64: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class3" +constructors_callable.py:66: error: Missing positional argument "x" in call [call-arg] +constructors_callable.py:67: error: Unexpected keyword argument "y" [call-arg] +constructors_callable.py:68: error: Too many arguments [call-arg] +constructors_callable.py:74: error: Incompatible return type for "__new__" (returns "int", but must return a subtype of "Class4") [misc] +constructors_callable.py:79: note: Revealed type is "def (x: builtins.int) -> builtins.int" +constructors_callable.py:81: error: Missing positional argument "x" in call [call-arg] +constructors_callable.py:82: error: Unexpected keyword argument "y" [call-arg] +constructors_callable.py:99: note: Revealed type is "def (*args: Any, **kwargs: Any) -> Never" +constructors_callable.py:118: error: Incompatible return type for "__new__" (returns "Class6Proxy", but must return a subtype of "Class6") [misc] +constructors_callable.py:127: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class6" +constructors_callable.py:128: error: Expression is of type "Class6", not "Class6Proxy" [misc] +constructors_callable.py:128: error: Missing positional argument "x" in call [call-arg] +constructors_callable.py:144: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class6Any" +constructors_callable.py:145: error: Expression is of type "Class6Any", not "Any" [misc] +constructors_callable.py:145: error: Missing positional argument "x" in call [call-arg] +constructors_callable.py:162: error: Need type annotation for "r7" [var-annotated] +constructors_callable.py:164: note: Revealed type is "def (x: builtins.int) -> constructors_callable.Class7[Any]" +constructors_callable.py:166: error: Expression is of type "Class7[Any]", not "Class7[int]" [misc] +constructors_callable.py:167: error: Expression is of type "Class7[Any]", not "Class7[str]" [misc] +constructors_callable.py:167: error: Argument 1 has incompatible type "str"; expected "int" [arg-type] +constructors_callable.py:184: note: Revealed type is "def [T] (x: builtins.list[T], y: builtins.list[T]) -> constructors_callable.Class8[T]" +constructors_callable.py:186: error: List item 0 has incompatible type "str"; expected "int" [list-item] +constructors_callable.py:195: note: Revealed type is "def (x: builtins.list[T], y: builtins.list[T]) -> constructors_callable.Class9" +constructors_callable.py:196: error: List item 0 has incompatible type "str"; expected "T" [list-item] +constructors_callable.py:196: error: List item 0 has incompatible type "str"; expected "T" [list-item] +constructors_callable.py:197: error: List item 0 has incompatible type "int"; expected "T" [list-item] +constructors_callable.py:197: error: List item 0 has incompatible type "str"; expected "T" [list-item] """ diff --git a/conformance/results/zuban/generics_defaults.toml b/conformance/results/zuban/generics_defaults.toml index c40a48dc..f0bef676 100644 --- a/conformance/results/zuban/generics_defaults.toml +++ b/conformance/results/zuban/generics_defaults.toml @@ -6,17 +6,17 @@ ParamSpec after TypeVarTuple is not always handled correctly """ conformance_automated = "Fail" errors_diff = """ -Line 142: Expected 1 errors -Line 155: Unexpected errors ['generics_defaults.py:155: error: Expression is of type "type[Foo6[int, [*Any, **Any]]]", not "type[Foo6[int, str, [float, bool]]]" [misc]', 'generics_defaults.py:155: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]'] -Line 170: Unexpected errors ['generics_defaults.py:170: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [misc]'] +Line 143: Expected 1 errors +Line 156: Unexpected errors ['generics_defaults.py:156: error: Expression is of type "type[Foo6[int, [*Any, **Any]]]", not "type[Foo6[int, str, [float, bool]]]" [misc]', 'generics_defaults.py:156: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]'] +Line 171: Unexpected errors ['generics_defaults.py:171: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [misc]'] """ output = """ generics_defaults.py:24: error: "T" cannot appear after "DefaultStrT" in type parameter list because it has no default type [misc] generics_defaults.py:50: error: "AllTheDefaults" expects between 2 and 5 type arguments, but 1 given [type-arg] generics_defaults.py:107: error: TypeVar default must be a subtype of the bound type [misc] generics_defaults.py:114: error: TypeVar default must be one of the constraint types [misc] -generics_defaults.py:131: error: Expression is of type "int", not "Any" [misc] -generics_defaults.py:155: error: Expression is of type "type[Foo6[int, [*Any, **Any]]]", not "type[Foo6[int, str, [float, bool]]]" [misc] -generics_defaults.py:155: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc] -generics_defaults.py:170: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [misc] +generics_defaults.py:132: error: Expression is of type "int", not "Any" [misc] +generics_defaults.py:156: error: Expression is of type "type[Foo6[int, [*Any, **Any]]]", not "type[Foo6[int, str, [float, bool]]]" [misc] +generics_defaults.py:156: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc] +generics_defaults.py:171: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [misc] """ diff --git a/conformance/results/zuban/generics_self_basic.toml b/conformance/results/zuban/generics_self_basic.toml index 7bb339c7..428c5a58 100644 --- a/conformance/results/zuban/generics_self_basic.toml +++ b/conformance/results/zuban/generics_self_basic.toml @@ -4,5 +4,5 @@ errors_diff = """ output = """ generics_self_basic.py:20: error: Incompatible return value type (got "Shape", expected "Self") [return-value] generics_self_basic.py:33: error: Incompatible return value type (got "Shape", expected "Self") [return-value] -generics_self_basic.py:67: error: Self type cannot have type arguments [valid-type] +generics_self_basic.py:68: error: Self type cannot have type arguments [valid-type] """ diff --git a/conformance/results/zuban/generics_self_usage.toml b/conformance/results/zuban/generics_self_usage.toml index eae8958d..ef5859e8 100644 --- a/conformance/results/zuban/generics_self_usage.toml +++ b/conformance/results/zuban/generics_self_usage.toml @@ -4,8 +4,8 @@ Does not detect invalid Self when Self is not properly bound""" conformance_automated = "Fail" errors_diff = """ Line 82: Expected 1 errors -Line 111: Expected 1 errors -Line 116: Expected 1 errors +Line 113: Expected 1 errors +Line 118: Expected 1 errors Line 50: Unexpected errors ['generics_self_usage.py:50: error: Incompatible types in assignment (expression has type "Callable[[CallableAttribute], int]", variable has type "Callable[[Self], int]") [assignment]'] """ output = """ @@ -13,10 +13,10 @@ generics_self_usage.py:50: error: Incompatible types in assignment (expression h generics_self_usage.py:73: error: Self type is only allowed in annotations within class definition [misc] generics_self_usage.py:73: error: Self type is only allowed in annotations within class definition [misc] generics_self_usage.py:76: error: Self type is only allowed in annotations within class definition [misc] -generics_self_usage.py:86: error: Incompatible return value type (got "Foo3", expected "Self") [return-value] -generics_self_usage.py:101: error: Self type is only allowed in annotations within class definition [misc] +generics_self_usage.py:87: error: Incompatible return value type (got "Foo3", expected "Self") [return-value] generics_self_usage.py:103: error: Self type is only allowed in annotations within class definition [misc] -generics_self_usage.py:106: error: Self type cannot be used in type alias target [misc] -generics_self_usage.py:121: error: Self type cannot be used in a metaclass [misc] -generics_self_usage.py:125: error: Self type cannot be used in a metaclass [misc] +generics_self_usage.py:105: error: Self type is only allowed in annotations within class definition [misc] +generics_self_usage.py:108: error: Self type cannot be used in type alias target [misc] +generics_self_usage.py:123: error: Self type cannot be used in a metaclass [misc] +generics_self_usage.py:127: error: Self type cannot be used in a metaclass [misc] """ diff --git a/conformance/results/zuban/generics_syntax_infer_variance.toml b/conformance/results/zuban/generics_syntax_infer_variance.toml index 796dcd31..e1207f92 100644 --- a/conformance/results/zuban/generics_syntax_infer_variance.toml +++ b/conformance/results/zuban/generics_syntax_infer_variance.toml @@ -11,8 +11,6 @@ output = """ generics_syntax_infer_variance.py:15: error: Cannot use covariant with infer_variance [misc] generics_syntax_infer_variance.py:17: error: Cannot use contravariant with infer_variance [misc] generics_syntax_infer_variance.py:29: error: Incompatible types in assignment (expression has type "ShouldBeCovariant1[float]", variable has type "ShouldBeCovariant1[int]") [assignment] -generics_syntax_infer_variance.py:39: note: If the method is meant to be abstract, use @abc.abstractmethod -generics_syntax_infer_variance.py:42: note: If the method is meant to be abstract, use @abc.abstractmethod generics_syntax_infer_variance.py:47: error: Incompatible types in assignment (expression has type "ShouldBeCovariant2[float]", variable has type "ShouldBeCovariant2[int]") [assignment] generics_syntax_infer_variance.py:56: error: Incompatible types in assignment (expression has type "ShouldBeCovariant3[float]", variable has type "ShouldBeCovariant3[int]") [assignment] generics_syntax_infer_variance.py:85: error: Incompatible types in assignment (expression has type "ShouldBeCovariant5[float]", variable has type "ShouldBeCovariant5[int]") [assignment] diff --git a/conformance/results/zuban/overloads_definitions.toml b/conformance/results/zuban/overloads_definitions.toml index c24ff027..a4f9c38f 100644 --- a/conformance/results/zuban/overloads_definitions.toml +++ b/conformance/results/zuban/overloads_definitions.toml @@ -8,11 +8,11 @@ overloads_definitions.py:59: error: An overloaded function outside a stub file m overloads_definitions.py:71: error: Overload does not consistently use the "@staticmethod" decorator on all function signatures. [misc] overloads_definitions.py:84: error: Overload does not consistently use the "@classmethod" decorator on all function signatures. [misc] overloads_definitions.py:93: error: Overloaded function implementation does not accept all possible arguments of signature 2 [misc] -overloads_definitions.py:122: error: @final should be applied only to overload implementation [misc] -overloads_definitions.py:136: error: @final should be applied only to overload implementation [misc] -overloads_definitions.py:141: error: @final should be applied only to overload implementation [misc] -overloads_definitions.py:175: error: Cannot override final attribute "final_method" (previously declared in base class "Base") [misc] -overloads_definitions.py:190: error: Method "bad_override" is marked as an override, but no base method was found with this name [misc] -overloads_definitions.py:221: error: @override should be applied only to overload implementation [misc] -overloads_definitions.py:225: error: @override should be applied only to overload implementation [misc] +overloads_definitions.py:123: error: @final should be applied only to overload implementation [misc] +overloads_definitions.py:138: error: @final should be applied only to overload implementation [misc] +overloads_definitions.py:143: error: @final should be applied only to overload implementation [misc] +overloads_definitions.py:180: error: Cannot override final attribute "final_method" (previously declared in base class "Base") [misc] +overloads_definitions.py:195: error: Method "bad_override" is marked as an override, but no base method was found with this name [misc] +overloads_definitions.py:227: error: @override should be applied only to overload implementation [misc] +overloads_definitions.py:231: error: @override should be applied only to overload implementation [misc] """ diff --git a/conformance/results/zuban/overloads_evaluation.toml b/conformance/results/zuban/overloads_evaluation.toml index 893e0fcb..300c1fff 100644 --- a/conformance/results/zuban/overloads_evaluation.toml +++ b/conformance/results/zuban/overloads_evaluation.toml @@ -8,16 +8,16 @@ Evaluates Any in some cases where overload is not ambiguous. """ conformance_automated = "Fail" errors_diff = """ -Line 134: Unexpected errors ['overloads_evaluation.py:134: error: No overload variant of "expand_bool" matches argument type "bool" [call-overload]'] -Line 135: Unexpected errors ['overloads_evaluation.py:135: error: Expression is of type "Any", not "Literal[0, 1]" [misc]'] -Line 160: Unexpected errors ['overloads_evaluation.py:160: error: No overload variant of "expand_enum" matches argument type "Color" [call-overload]'] -Line 161: Unexpected errors ['overloads_evaluation.py:161: error: Expression is of type "Any", not "Literal[0, 1]" [misc]'] -Line 204: Unexpected errors ['overloads_evaluation.py:204: error: Argument 1 to "expand_tuple" has incompatible type "tuple[int, int | str]"; expected "tuple[int, int]" [arg-type]'] -Line 205: Unexpected errors ['overloads_evaluation.py:205: error: Expression is of type "int", not "int | str" [misc]'] -Line 261: Unexpected errors ['overloads_evaluation.py:261: error: Expression is of type "list[Any]", not "list[int]" [misc]'] -Line 264: Unexpected errors ['overloads_evaluation.py:264: error: Expression is of type "list[Any]", not "Any" [misc]'] -Line 280: Unexpected errors ['overloads_evaluation.py:280: error: Expression is of type "list[Any]", not "Any" [misc]'] -Line 345: Unexpected errors ['overloads_evaluation.py:345: error: Expression is of type "list[Any]", not "Any" [misc]'] +Line 135: Unexpected errors ['overloads_evaluation.py:135: error: No overload variant of "expand_bool" matches argument type "bool" [call-overload]'] +Line 136: Unexpected errors ['overloads_evaluation.py:136: error: Expression is of type "Any", not "Literal[0, 1]" [misc]'] +Line 161: Unexpected errors ['overloads_evaluation.py:161: error: No overload variant of "expand_enum" matches argument type "Color" [call-overload]'] +Line 162: Unexpected errors ['overloads_evaluation.py:162: error: Expression is of type "Any", not "Literal[0, 1]" [misc]'] +Line 205: Unexpected errors ['overloads_evaluation.py:205: error: Argument 1 to "expand_tuple" has incompatible type "tuple[int, int | str]"; expected "tuple[int, int]" [arg-type]'] +Line 206: Unexpected errors ['overloads_evaluation.py:206: error: Expression is of type "int", not "int | str" [misc]'] +Line 262: Unexpected errors ['overloads_evaluation.py:262: error: Expression is of type "list[Any]", not "list[int]" [misc]'] +Line 265: Unexpected errors ['overloads_evaluation.py:265: error: Expression is of type "list[Any]", not "Any" [misc]'] +Line 281: Unexpected errors ['overloads_evaluation.py:281: error: Expression is of type "list[Any]", not "Any" [misc]'] +Line 347: Unexpected errors ['overloads_evaluation.py:347: error: Expression is of type "list[Any]", not "Any" [misc]'] """ output = """ overloads_evaluation.py:38: error: All overload variants of "example1_1" require at least one argument [call-overload] @@ -32,22 +32,22 @@ overloads_evaluation.py:51: error: No overload variant of "example1_1" matches a overloads_evaluation.py:51: note: Possible overload variants: overloads_evaluation.py:51: note: def example1_1(x: int, y: str) -> int overloads_evaluation.py:51: note: def example1_1(x: str) -> str -overloads_evaluation.py:115: error: Argument 1 to "example2" has incompatible type "int | str"; expected "int" [arg-type] -overloads_evaluation.py:115: error: Argument 2 to "example2" has incompatible type "int | str"; expected "str" [arg-type] -overloads_evaluation.py:134: error: No overload variant of "expand_bool" matches argument type "bool" [call-overload] -overloads_evaluation.py:134: note: Possible overload variants: -overloads_evaluation.py:134: note: def expand_bool(x: Literal[False]) -> Literal[0] -overloads_evaluation.py:134: note: def expand_bool(x: Literal[True]) -> Literal[1] -overloads_evaluation.py:135: error: Expression is of type "Any", not "Literal[0, 1]" [misc] -overloads_evaluation.py:160: error: No overload variant of "expand_enum" matches argument type "Color" [call-overload] -overloads_evaluation.py:160: note: Possible overload variants: -overloads_evaluation.py:160: note: def expand_enum(x: Literal[Color.RED]) -> Literal[0] -overloads_evaluation.py:160: note: def expand_enum(x: Literal[Color.BLUE]) -> Literal[1] -overloads_evaluation.py:161: error: Expression is of type "Any", not "Literal[0, 1]" [misc] -overloads_evaluation.py:204: error: Argument 1 to "expand_tuple" has incompatible type "tuple[int, int | str]"; expected "tuple[int, int]" [arg-type] -overloads_evaluation.py:205: error: Expression is of type "int", not "int | str" [misc] -overloads_evaluation.py:261: error: Expression is of type "list[Any]", not "list[int]" [misc] -overloads_evaluation.py:264: error: Expression is of type "list[Any]", not "Any" [misc] -overloads_evaluation.py:280: error: Expression is of type "list[Any]", not "Any" [misc] -overloads_evaluation.py:345: error: Expression is of type "list[Any]", not "Any" [misc] +overloads_evaluation.py:116: error: Argument 1 to "example2" has incompatible type "int | str"; expected "int" [arg-type] +overloads_evaluation.py:116: error: Argument 2 to "example2" has incompatible type "int | str"; expected "str" [arg-type] +overloads_evaluation.py:135: error: No overload variant of "expand_bool" matches argument type "bool" [call-overload] +overloads_evaluation.py:135: note: Possible overload variants: +overloads_evaluation.py:135: note: def expand_bool(x: Literal[False]) -> Literal[0] +overloads_evaluation.py:135: note: def expand_bool(x: Literal[True]) -> Literal[1] +overloads_evaluation.py:136: error: Expression is of type "Any", not "Literal[0, 1]" [misc] +overloads_evaluation.py:161: error: No overload variant of "expand_enum" matches argument type "Color" [call-overload] +overloads_evaluation.py:161: note: Possible overload variants: +overloads_evaluation.py:161: note: def expand_enum(x: Literal[Color.RED]) -> Literal[0] +overloads_evaluation.py:161: note: def expand_enum(x: Literal[Color.BLUE]) -> Literal[1] +overloads_evaluation.py:162: error: Expression is of type "Any", not "Literal[0, 1]" [misc] +overloads_evaluation.py:205: error: Argument 1 to "expand_tuple" has incompatible type "tuple[int, int | str]"; expected "tuple[int, int]" [arg-type] +overloads_evaluation.py:206: error: Expression is of type "int", not "int | str" [misc] +overloads_evaluation.py:262: error: Expression is of type "list[Any]", not "list[int]" [misc] +overloads_evaluation.py:265: error: Expression is of type "list[Any]", not "Any" [misc] +overloads_evaluation.py:281: error: Expression is of type "list[Any]", not "Any" [misc] +overloads_evaluation.py:347: error: Expression is of type "list[Any]", not "Any" [misc] """ diff --git a/conformance/src/type_checker.py b/conformance/src/type_checker.py index 4307039f..c373fc4f 100644 --- a/conformance/src/type_checker.py +++ b/conformance/src/type_checker.py @@ -102,8 +102,6 @@ def run_tests(self, test_files: Sequence[str]) -> dict[str, str]: "-m", "mypy", ".", - "--disable-error-code", - "empty-body", "--enable-error-code", "deprecated", ] diff --git a/conformance/tests/constructors_call_new.py b/conformance/tests/constructors_call_new.py index 889fcec4..48275c33 100644 --- a/conformance/tests/constructors_call_new.py +++ b/conformance/tests/constructors_call_new.py @@ -110,7 +110,8 @@ def __init__(self, x: int): class Class8(Generic[T]): - def __new__(cls, *args, **kwargs) -> "Class8[list[T]]": ... + def __new__(cls, *args, **kwargs) -> "Class8[list[T]]": + raise NotImplementedError assert_type(Class8[int](), Class8[list[int]]) @@ -122,7 +123,8 @@ def __new__(cls, *args, **kwargs) -> "Class8[list[T]]": ... class Class9(Generic[T]): - def __new__(cls, *args, **kwargs) -> Self: ... + def __new__(cls, *args, **kwargs) -> Self: + raise NotImplementedError class Class10(Class9[int]): @@ -137,7 +139,8 @@ class Class10(Class9[int]): class Class11(Generic[T]): - def __new__(cls: "type[Class11[int]]") -> "Class11[int]": ... + def __new__(cls: "type[Class11[int]]") -> "Class11[int]": + raise NotImplementedError Class11() # OK diff --git a/conformance/tests/constructors_callable.py b/conformance/tests/constructors_callable.py index bfd1e405..c05fee3f 100644 --- a/conformance/tests/constructors_callable.py +++ b/conformance/tests/constructors_callable.py @@ -54,7 +54,8 @@ class Class2: class Class3: """__new__ and __init__""" - def __new__(cls, *args, **kwargs) -> Self: ... + def __new__(cls, *args, **kwargs) -> Self: + raise NotImplementedError def __init__(self, x: int) -> None: ... @@ -70,7 +71,8 @@ def __init__(self, x: int) -> None: ... class Class4: """__new__ but no __init__""" - def __new__(cls, x: int) -> int: ... + def __new__(cls, x: int) -> int: + raise NotImplementedError r4 = accepts_callable(Class4) diff --git a/conformance/tests/dataclasses_descriptors.py b/conformance/tests/dataclasses_descriptors.py index 37dd1b36..f2f30a62 100644 --- a/conformance/tests/dataclasses_descriptors.py +++ b/conformance/tests/dataclasses_descriptors.py @@ -21,7 +21,7 @@ def __get__(self, __obj: object, __owner: Any) -> int: ... def __get__(self, __obj: object | None, __owner: Any) -> "int | Desc1": - ... + raise NotImplementedError def __set__(self, __obj: object, __value: int) -> None: ... @@ -48,7 +48,7 @@ def __get__(self, instance: object, owner: Any) -> T: ... def __get__(self, instance: object | None, owner: Any) -> list[T] | T: - ... + raise NotImplementedError @dataclass diff --git a/conformance/tests/dataclasses_transform_converter.py b/conformance/tests/dataclasses_transform_converter.py index 277998c7..0a54584e 100644 --- a/conformance/tests/dataclasses_transform_converter.py +++ b/conformance/tests/dataclasses_transform_converter.py @@ -23,7 +23,7 @@ def model_field( default: S | None = None, default_factory: Callable[[], S] | None = None, ) -> T: - ... + raise NotImplementedError @dataclass_transform(field_specifiers=(model_field,)) diff --git a/conformance/tests/dataclasses_transform_field.py b/conformance/tests/dataclasses_transform_field.py index d66bdf9e..c6ccb8b7 100644 --- a/conformance/tests/dataclasses_transform_field.py +++ b/conformance/tests/dataclasses_transform_field.py @@ -47,7 +47,7 @@ def field2(*, init: bool = False, kw_only: bool = True) -> Any: @dataclass_transform(kw_only_default=True, field_specifiers=(field1, field2)) def create_model(*, init: bool = True) -> Callable[[type[T]], type[T]]: - ... + raise NotImplementedError @create_model() diff --git a/conformance/tests/dataclasses_transform_func.py b/conformance/tests/dataclasses_transform_func.py index c2eb1f34..0a792271 100644 --- a/conformance/tests/dataclasses_transform_func.py +++ b/conformance/tests/dataclasses_transform_func.py @@ -74,7 +74,7 @@ class Customer2Subclass(Customer2): @dataclass_transform(kw_only_default=True, order_default=True, frozen_default=True) def create_model_frozen(cls: T) -> T: - ... + raise NotImplementedError @create_model_frozen diff --git a/conformance/tests/generics_defaults.py b/conformance/tests/generics_defaults.py index 241606c9..e1a4fb04 100644 --- a/conformance/tests/generics_defaults.py +++ b/conformance/tests/generics_defaults.py @@ -124,7 +124,8 @@ class Class_TypeVarTuple(Generic[*DefaultTs]): ... T4 = TypeVar("T4", default=int) -def func1(x: int | set[T4]) -> T4: ... +def func1(x: int | set[T4]) -> T4: + raise NotImplementedError assert_type(func1(0), int) # E[optional-default-use] diff --git a/conformance/tests/generics_paramspec_basic.py b/conformance/tests/generics_paramspec_basic.py index 01da2db3..7d461c2f 100644 --- a/conformance/tests/generics_paramspec_basic.py +++ b/conformance/tests/generics_paramspec_basic.py @@ -25,7 +25,7 @@ def func1(x: P) -> P: # E def func2(x: Concatenate[int, P]) -> int: # E - ... + raise NotImplementedError def func3(x: list[P]) -> None: # E diff --git a/conformance/tests/generics_paramspec_semantics.py b/conformance/tests/generics_paramspec_semantics.py index b93066f1..836d461d 100644 --- a/conformance/tests/generics_paramspec_semantics.py +++ b/conformance/tests/generics_paramspec_semantics.py @@ -11,11 +11,11 @@ def changes_return_type_to_str(x: Callable[P, int]) -> Callable[P, str]: - ... + raise NotImplementedError def returns_int(a: str, b: bool, /) -> int: - ... + raise NotImplementedError f1 = changes_return_type_to_str(returns_int) @@ -28,15 +28,15 @@ def returns_int(a: str, b: bool, /) -> int: def func1(x: Callable[P, int], y: Callable[P, int]) -> Callable[P, bool]: - ... + raise NotImplementedError def x_y(x: int, y: str) -> int: - ... + raise NotImplementedError def y_x(y: int, x: str) -> int: - ... + raise NotImplementedError f2 = func1(x_y, x_y) @@ -51,11 +51,11 @@ def y_x(y: int, x: str) -> int: def keyword_only_x(*, x: int) -> int: - ... + raise NotImplementedError def keyword_only_y(*, y: int) -> int: - ... + raise NotImplementedError func1(keyword_only_x, keyword_only_y) # E @@ -74,7 +74,7 @@ def __init__(self, f: Callable[P, str], prop: U) -> None: def callback_a(q: int, /) -> str: - ... + raise NotImplementedError def func(x: int) -> None: @@ -85,11 +85,11 @@ def func(x: int) -> None: def bar(x: int, *args: bool) -> int: - ... + raise NotImplementedError def add(x: Callable[P, int]) -> Callable[Concatenate[str, P], bool]: - ... + raise NotImplementedError a1 = add(bar) # Should return (a: str, /, x: int, *args: bool) -> bool @@ -99,7 +99,7 @@ def add(x: Callable[P, int]) -> Callable[Concatenate[str, P], bool]: def remove(x: Callable[Concatenate[int, P], int]) -> Callable[P, bool]: - ... + raise NotImplementedError r1 = remove(bar) # Should return (*args: bool) -> bool @@ -111,7 +111,7 @@ def remove(x: Callable[Concatenate[int, P], int]) -> Callable[P, bool]: def transform( x: Callable[Concatenate[int, P], int] ) -> Callable[Concatenate[str, P], bool]: - ... + raise NotImplementedError t1 = transform(bar) # Should return (a: str, /, *args: bool) -> bool @@ -126,19 +126,19 @@ def expects_int_first(x: Callable[Concatenate[int, P], int]) -> None: @expects_int_first # E def one(x: str) -> int: - ... + raise NotImplementedError @expects_int_first # E def two(*, x: int) -> int: - ... + raise NotImplementedError @expects_int_first # E def three(**kwargs: int) -> int: - ... + raise NotImplementedError @expects_int_first # OK def four(*args: int) -> int: - ... + raise NotImplementedError diff --git a/conformance/tests/generics_self_advanced.py b/conformance/tests/generics_self_advanced.py index ef4f6af7..ab389081 100644 --- a/conformance/tests/generics_self_advanced.py +++ b/conformance/tests/generics_self_advanced.py @@ -9,7 +9,7 @@ class ParentA: # Test for property that returns Self. @property def prop1(self) -> Self: - ... + raise NotImplementedError class ChildA(ParentA): ... @@ -26,7 +26,7 @@ class ParentB: @classmethod def method1(cls) -> Self: - ... + raise NotImplementedError class ChildB(ParentB): b: int = 0 diff --git a/conformance/tests/generics_self_basic.py b/conformance/tests/generics_self_basic.py index b7da6a38..d5712383 100644 --- a/conformance/tests/generics_self_basic.py +++ b/conformance/tests/generics_self_basic.py @@ -61,7 +61,8 @@ class Container(Generic[T]): def __init__(self, value: T) -> None: self.value = value - def set_value(self, value: T) -> Self: ... + def set_value(self, value: T) -> Self: + raise NotImplementedError # This should generate an error because Self isn't subscriptable. def foo(self, other: Self[int]) -> None: # E diff --git a/conformance/tests/generics_self_usage.py b/conformance/tests/generics_self_usage.py index 6990cbd1..99f36a81 100644 --- a/conformance/tests/generics_self_usage.py +++ b/conformance/tests/generics_self_usage.py @@ -79,7 +79,8 @@ def foo(bar: Self) -> Self: ... # E: not within a class class Foo2: # Rejected (Self is treated as unknown). - def has_existing_self_annotation(self: TFoo2) -> Self: ... # E + def has_existing_self_annotation(self: TFoo2) -> Self: # E + raise NotImplementedError class Foo3: def return_concrete_type(self) -> Self: @@ -95,7 +96,8 @@ def child_method(self) -> None: T = TypeVar("T") class Bar(Generic[T]): - def bar(self) -> T: ... + def bar(self) -> T: + raise NotImplementedError # This should generate an error. class Baz(Bar[Self]): ... # E @@ -109,18 +111,18 @@ class Base: @staticmethod # This should generate an error. def make() -> Self: # E - ... + raise NotImplementedError @staticmethod # This should generate an error. def return_parameter(foo: Self) -> Self: # E - ... + raise NotImplementedError class MyMetaclass(type): # This should generate an error. def __new__(cls, *args: Any) -> Self: # E - ... + raise NotImplementedError # This should generate an error. def __mul__(cls, count: int) -> list[Self]: # E - ... + raise NotImplementedError diff --git a/conformance/tests/generics_syntax_compatibility.py b/conformance/tests/generics_syntax_compatibility.py index 506d26d4..144cbb78 100644 --- a/conformance/tests/generics_syntax_compatibility.py +++ b/conformance/tests/generics_syntax_compatibility.py @@ -21,7 +21,7 @@ class ClassB[K, V](dict[K, V]): # OK class ClassC[V]: def method1(self, a: V, b: K) -> V | K: # OK - ... + raise NotImplementedError def method2[M](self, a: M, b: K) -> M | K: # E - ... + raise NotImplementedError diff --git a/conformance/tests/generics_syntax_infer_variance.py b/conformance/tests/generics_syntax_infer_variance.py index 50d42616..e0f50a3b 100644 --- a/conformance/tests/generics_syntax_infer_variance.py +++ b/conformance/tests/generics_syntax_infer_variance.py @@ -19,10 +19,10 @@ class ShouldBeCovariant1(Generic[T]): def __getitem__(self, index: int) -> T: - ... + raise NotImplementedError def __iter__(self) -> Iterator[T]: - ... + raise NotImplementedError vco1_1: ShouldBeCovariant1[float] = ShouldBeCovariant1[int]() # OK @@ -37,10 +37,10 @@ def __getitem__(self, index: int) -> T: def __getitem__(self, index: slice) -> Sequence[T]: ... def __getitem__(self, index: int | slice) -> T | Sequence[T]: - ... + raise NotImplementedError def __len__(self) -> int: - ... + raise NotImplementedError vco2_1: ShouldBeCovariant2[float] = ShouldBeCovariant2[int]() # OK @@ -49,7 +49,7 @@ def __len__(self) -> int: class ShouldBeCovariant3(Generic[T]): def method1(self) -> "ShouldBeCovariant2[T]": - ... + raise NotImplementedError vco3_1: ShouldBeCovariant3[float] = ShouldBeCovariant3[int]() # OK diff --git a/conformance/tests/generics_syntax_scoping.py b/conformance/tests/generics_syntax_scoping.py index f2f1bc29..2d3f5639 100644 --- a/conformance/tests/generics_syntax_scoping.py +++ b/conformance/tests/generics_syntax_scoping.py @@ -38,7 +38,7 @@ class ClassC[T](BaseClassC[T], param=Foo[T]): # OK def decorator1[ T, **P, R ](x: type[Foo[T]]) -> Callable[[Callable[P, R]], Callable[P, R]]: - ... + raise NotImplementedError @decorator1(Foo[T]) # E: Runtime error: 'T' is not defined @@ -79,7 +79,7 @@ def method1[T](self, a: Inner[T]) -> Inner[T]: # OK def decorator2[**P, R](x: int) -> Callable[[Callable[P, R]], Callable[P, R]]: - ... + raise NotImplementedError T = int(0) diff --git a/conformance/tests/generics_typevartuple_args.py b/conformance/tests/generics_typevartuple_args.py index fdc0e55a..114d2ec4 100644 --- a/conformance/tests/generics_typevartuple_args.py +++ b/conformance/tests/generics_typevartuple_args.py @@ -14,7 +14,7 @@ def args_to_tuple(*args: *Ts) -> tuple[*Ts]: - ... + raise NotImplementedError assert_type(args_to_tuple(1, "a"), tuple[int, str]) @@ -25,7 +25,7 @@ class Env: def exec_le(path: str, *args: * tuple[*Ts, Env], env: Env | None = None) -> tuple[*Ts]: - ... + raise NotImplementedError assert_type(exec_le("", Env()), tuple[()]) # OK diff --git a/conformance/tests/generics_typevartuple_basic.py b/conformance/tests/generics_typevartuple_basic.py index daf504fc..b5512c4b 100644 --- a/conformance/tests/generics_typevartuple_basic.py +++ b/conformance/tests/generics_typevartuple_basic.py @@ -14,7 +14,7 @@ class Array1(Generic[*Ts]): def func1(*args: *Ts) -> tuple[*Ts]: - ... + raise NotImplementedError Shape = TypeVarTuple("Shape") @@ -73,7 +73,7 @@ def method1(*args: Shape) -> None: # E: not unpacked def func2(arg1: tuple[*Ts], arg2: tuple[*Ts]) -> tuple[*Ts]: - ... + raise NotImplementedError # > We do not allow this; type unions may not appear within the tuple. @@ -91,7 +91,7 @@ def func2(arg1: tuple[*Ts], arg2: tuple[*Ts]) -> tuple[*Ts]: def multiply(x: Array[*Shape], y: Array[*Shape]) -> Array[*Shape]: - ... + raise NotImplementedError def func3(x: Array[Height], y: Array[Width], z: Array[Height, Width]): diff --git a/conformance/tests/generics_typevartuple_callable.py b/conformance/tests/generics_typevartuple_callable.py index 4ece6a97..f0292505 100644 --- a/conformance/tests/generics_typevartuple_callable.py +++ b/conformance/tests/generics_typevartuple_callable.py @@ -27,15 +27,15 @@ def func1(arg1: int, arg2: str) -> None: def func2(f: Callable[[int, *Ts, T], tuple[T, *Ts]]) -> tuple[*Ts, T]: - ... + raise NotImplementedError def callback1(a: int, b: str, c: int, d: complex) -> tuple[complex, str, int]: - ... + raise NotImplementedError def callback2(a: int, d: str) -> tuple[str]: - ... + raise NotImplementedError assert_type(func2(callback1), tuple[str, int, complex]) @@ -43,7 +43,7 @@ def callback2(a: int, d: str) -> tuple[str]: def func3(*args: * tuple[int, *Ts, T]) -> tuple[T, *Ts]: - ... + raise NotImplementedError assert_type(func3(1, "", 3j, 3.4), tuple[float, str, complex]) diff --git a/conformance/tests/generics_typevartuple_concat.py b/conformance/tests/generics_typevartuple_concat.py index 3f24821b..3d2284a8 100644 --- a/conformance/tests/generics_typevartuple_concat.py +++ b/conformance/tests/generics_typevartuple_concat.py @@ -24,15 +24,15 @@ class Array(Generic[*Ts]): def add_batch_axis(x: Array[*Shape]) -> Array[Batch, *Shape]: - ... + raise NotImplementedError def del_batch_axis(x: Array[Batch, *Shape]) -> Array[*Shape]: - ... + raise NotImplementedError def add_batch_channels(x: Array[*Shape]) -> Array[Batch, *Shape, Channels]: - ... + raise NotImplementedError def func1(a: Array[Height, Width]): @@ -45,7 +45,7 @@ def func1(a: Array[Height, Width]): def prefix_tuple(x: T, y: tuple[*Ts]) -> tuple[T, *Ts]: - ... + raise NotImplementedError z = prefix_tuple(x=0, y=(True, "a")) diff --git a/conformance/tests/generics_typevartuple_specialization.py b/conformance/tests/generics_typevartuple_specialization.py index 0f53c85b..3277e40b 100644 --- a/conformance/tests/generics_typevartuple_specialization.py +++ b/conformance/tests/generics_typevartuple_specialization.py @@ -128,7 +128,7 @@ def func6(a: VariadicTuple[str, int], b: VariadicTuple[float], c: VariadicTuple) def func7(a: TA7[*Ts, T1, T2]) -> tuple[tuple[*Ts], T1, T2]: - ... + raise NotImplementedError def func8(a: TA7[str, bool], b: TA7[str, bool, float], c: TA7[str, bool, float, int]): @@ -141,7 +141,7 @@ def func8(a: TA7[str, bool], b: TA7[str, bool, float], c: TA7[str, bool, float, def func9(a: TA8[T1, *Ts, T2, T3]) -> tuple[tuple[*Ts], T1, T2, T3]: - ... + raise NotImplementedError def func10(a: TA8[str, bool, float], b: TA8[str, bool, float, int]): diff --git a/conformance/tests/generics_variance.py b/conformance/tests/generics_variance.py index 0b3e732b..9f2f143e 100644 --- a/conformance/tests/generics_variance.py +++ b/conformance/tests/generics_variance.py @@ -24,7 +24,7 @@ def __init__(self, items: Iterable[T_co]) -> None: ... def __iter__(self) -> Iterator[T_co]: - ... + raise NotImplementedError class Employee: @@ -55,7 +55,7 @@ def dump_employee(e: E) -> E: # > Variance has no meaning, and should therefore be ignored by type checkers, # > if a type variable is bound to a generic function or type alias. def func(x: list[B_co]) -> B_co: # OK - ... + raise NotImplementedError class Co(Generic[T_co]): diff --git a/conformance/tests/generics_variance_inference.py b/conformance/tests/generics_variance_inference.py index c7e09760..0a1cd41c 100644 --- a/conformance/tests/generics_variance_inference.py +++ b/conformance/tests/generics_variance_inference.py @@ -17,7 +17,7 @@ def method1(self, a: T2) -> None: ... def method2(self) -> T3: - ... + raise NotImplementedError def func_a(p1: ClassA[float, int, int], p2: ClassA[int, float, float]): @@ -31,10 +31,10 @@ def func_a(p1: ClassA[float, int, int], p2: ClassA[int, float, float]): class ShouldBeCovariant1[T]: def __getitem__(self, index: int) -> T: - ... + raise NotImplementedError def __iter__(self) -> Iterator[T]: - ... + raise NotImplementedError vco1_1: ShouldBeCovariant1[float] = ShouldBeCovariant1[int]() # OK @@ -51,7 +51,7 @@ class ShouldBeCovariant2[T](ShouldBeCovariant1[T]): class ShouldBeCovariant3[T]: def method1(self) -> "ShouldBeCovariant2[T]": - ... + raise NotImplementedError vco3_1: ShouldBeCovariant3[float] = ShouldBeCovariant3[int]() # OK diff --git a/conformance/tests/literals_interactions.py b/conformance/tests/literals_interactions.py index 5d0a286e..14488132 100644 --- a/conformance/tests/literals_interactions.py +++ b/conformance/tests/literals_interactions.py @@ -58,13 +58,13 @@ def open(path: _PathType, mode: Any) -> Any: class Matrix(Generic[A, B]): def __add__(self, other: "Matrix[A, B]") -> "Matrix[A, B]": - ... + raise NotImplementedError def __matmul__(self, other: "Matrix[B, C]") -> "Matrix[A, C]": - ... + raise NotImplementedError def transpose(self) -> "Matrix[B, A]": - ... + raise NotImplementedError def func2(a: Matrix[Literal[2], Literal[3]], b: Matrix[Literal[3], Literal[7]]): diff --git a/conformance/tests/literals_literalstring.py b/conformance/tests/literals_literalstring.py index 25461dd1..99b51cdf 100644 --- a/conformance/tests/literals_literalstring.py +++ b/conformance/tests/literals_literalstring.py @@ -21,7 +21,7 @@ def my_function(literal_string: LiteralString) -> LiteralString: - ... + raise NotImplementedError class Foo: @@ -77,7 +77,7 @@ def func2(a: LiteralString, b: LiteralString): # > Conditional statements and expressions work as expected. def condition1() -> bool: - ... + raise NotImplementedError def return_literal_string() -> LiteralString: diff --git a/conformance/tests/overloads_definitions.py b/conformance/tests/overloads_definitions.py index 24ee5daa..67a62e61 100644 --- a/conformance/tests/overloads_definitions.py +++ b/conformance/tests/overloads_definitions.py @@ -114,7 +114,8 @@ def final_method(self, x: int) -> int: ... def final_method(self, x: str) -> str: ... @final - def final_method(self, x: int | str) -> int | str: ... + def final_method(self, x: int | str) -> int | str: + raise NotImplementedError # The @final decorator should not be on one of the overloads: @@ -127,7 +128,8 @@ def invalid_final(self, x: int) -> int: # E[invalid_final] def invalid_final(self, x: str) -> str: # E[invalid_final] ... - def invalid_final(self, x: int | str) -> int | str: ... + def invalid_final(self, x: int | str) -> int | str: + raise NotImplementedError # The @final decorator should not be on multiple overloads and # implementation: @@ -143,7 +145,8 @@ def invalid_final_2(self, x: str) -> str: # E[invalid_final_2+] ... @final - def invalid_final_2(self, x: int | str) -> int | str: ... + def invalid_final_2(self, x: int | str) -> int | str: + raise NotImplementedError # These methods are just here for the @override test below. We use an # overload because mypy doesn't like overriding a non-overloaded method @@ -156,7 +159,8 @@ def good_override(self, x: int) -> int: ... @overload def good_override(self, x: str) -> str: ... - def good_override(self, x: int | str) -> int | str: ... + def good_override(self, x: int | str) -> int | str: + raise NotImplementedError @overload def to_override(self, x: int) -> int: ... @@ -164,7 +168,8 @@ def to_override(self, x: int) -> int: ... @overload def to_override(self, x: str) -> str: ... - def to_override(self, x: int | str) -> int | str: ... + def to_override(self, x: int | str) -> int | str: + raise NotImplementedError class Child(Base): # E[override-final] @@ -181,7 +186,7 @@ def final_method(self, x: str) -> str: ... def final_method( # E[override-final] can't override final method self, x: int | str ) -> int | str: # E[override-final] can't override final method - ... + raise NotImplementedError # This is the right way to mark an overload as @override (decorate # implementation only), so the use of @override should cause an error @@ -196,7 +201,7 @@ def bad_override(self, x: str) -> str: ... @override # E[bad_override] def bad_override(self, x: int | str) -> int | str: # E[bad_override] - ... + raise NotImplementedError # This is also a correctly-decorated overloaded @override, which is # overriding a method that does exist in the base, so there should be no @@ -212,7 +217,8 @@ def good_override(self, x: int) -> int: ... def good_override(self, x: str) -> str: ... @override - def good_override(self, x: int | str) -> int | str: ... + def good_override(self, x: int | str) -> int | str: + raise NotImplementedError # This is the wrong way to use @override with an overloaded method, and # should emit an error: @@ -226,4 +232,5 @@ def to_override(self, x: int) -> int: ... # E[override_impl+] def to_override(self, x: str) -> str: ... # E[override_impl+] @override - def to_override(self, x: int | str) -> int | str: ... + def to_override(self, x: int | str) -> int | str: + raise NotImplementedError diff --git a/conformance/tests/overloads_evaluation.py b/conformance/tests/overloads_evaluation.py index 094b177e..518b864a 100644 --- a/conformance/tests/overloads_evaluation.py +++ b/conformance/tests/overloads_evaluation.py @@ -59,7 +59,8 @@ def example1_2(b: Literal[True] = ...) -> int: ... def example1_2(b: bool) -> float: ... -def example1_2(b: bool = True) -> float: ... +def example1_2(b: bool = True) -> float: + raise NotImplementedError def check_example1_2() -> None: @@ -288,7 +289,8 @@ def example6(a: int, b: Any) -> float: ... def example6(a: float, b: T) -> T: ... -def example6(a: float, b: T) -> T: ... +def example6(a: float, b: T) -> T: + raise NotImplementedError def check_example6(a: list[Any], b: Any, c: str) -> None: diff --git a/conformance/tests/protocols_recursive.py b/conformance/tests/protocols_recursive.py index 9b6c9f03..9461f4a6 100644 --- a/conformance/tests/protocols_recursive.py +++ b/conformance/tests/protocols_recursive.py @@ -74,7 +74,7 @@ def method2(cls: type[ProtoB[object, T]], value: list[T]) -> None: def func1(x: ProtoA[Never, T]) -> T: - ... + raise NotImplementedError v1 = func1(ImplB())