Skip to content

Commit

Permalink
Updated conformance test results for pyright 1.1.359. (#1719)
Browse files Browse the repository at this point in the history
Most of the changes are due to improvements in error message wording. Fixed a couple of bugs in the tests that were uncovered by recent changes in pyright. Pyright 1.1.359 fixed several conformance issues (specifically with constructor calls and forward references in PEP 695 syntax) but also introduced two conformance regressions that were caught by the tests.
  • Loading branch information
erictraut committed Apr 17, 2024
1 parent b3b902d commit c0f9dec
Show file tree
Hide file tree
Showing 79 changed files with 502 additions and 541 deletions.
24 changes: 12 additions & 12 deletions conformance/results/mypy/dataclasses_usage.toml
Expand Up @@ -3,18 +3,18 @@ notes = """
Does not detect unannotated usage of `dataclasses.field()`.
"""
output = """
dataclasses_usage.py:36: error: Accessing "__init__" on an instance is unsound, since instance.__init__ could be from an incompatible subclass [misc]
dataclasses_usage.py:51: error: Missing positional argument "unit_price" in call to "InventoryItem" [call-arg]
dataclasses_usage.py:52: error: Argument 2 to "InventoryItem" has incompatible type "str"; expected "float" [arg-type]
dataclasses_usage.py:53: error: Too many arguments for "InventoryItem" [call-arg]
dataclasses_usage.py:62: error: Attributes without a default cannot follow attributes with one [misc]
dataclasses_usage.py:68: error: Attributes without a default cannot follow attributes with one [misc]
dataclasses_usage.py:74: error: Attributes without a default cannot follow attributes with one [misc]
dataclasses_usage.py:84: error: Too many arguments for "DC4" [call-arg]
dataclasses_usage.py:89: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]
dataclasses_usage.py:127: error: Too many arguments for "DC7" [call-arg]
dataclasses_usage.py:130: error: Missing positional argument "y" in call to "DC8" [call-arg]
dataclasses_usage.py:179: error: Too many arguments for "DC13" [call-arg]
dataclasses_usage.py:35: error: Accessing "__init__" on an instance is unsound, since instance.__init__ could be from an incompatible subclass [misc]
dataclasses_usage.py:50: error: Missing positional argument "unit_price" in call to "InventoryItem" [call-arg]
dataclasses_usage.py:51: error: Argument 2 to "InventoryItem" has incompatible type "str"; expected "float" [arg-type]
dataclasses_usage.py:52: error: Too many arguments for "InventoryItem" [call-arg]
dataclasses_usage.py:61: error: Attributes without a default cannot follow attributes with one [misc]
dataclasses_usage.py:67: error: Attributes without a default cannot follow attributes with one [misc]
dataclasses_usage.py:73: error: Attributes without a default cannot follow attributes with one [misc]
dataclasses_usage.py:83: error: Too many arguments for "DC4" [call-arg]
dataclasses_usage.py:88: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]
dataclasses_usage.py:126: error: Too many arguments for "DC7" [call-arg]
dataclasses_usage.py:129: error: Missing positional argument "y" in call to "DC8" [call-arg]
dataclasses_usage.py:178: error: Too many arguments for "DC13" [call-arg]
"""
conformance_automated = "Pass"
errors_diff = """
Expand Down
13 changes: 4 additions & 9 deletions conformance/results/mypy/generics_self_basic.toml
@@ -1,14 +1,9 @@
conformant = "Partial"
notes = """
Does not properly handle constructor call through `cls` parameter.
"""
conformant = "Pass"
output = """
generics_self_basic.py:19: error: Incompatible return value type (got "Shape", expected "Self") [return-value]
generics_self_basic.py:27: error: Too many arguments for "Shape" [call-arg]
generics_self_basic.py:32: error: Incompatible return value type (got "Shape", expected "Self") [return-value]
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:64: error: Self type cannot have type arguments [misc]
"""
conformance_automated = "Fail"
conformance_automated = "Pass"
errors_diff = """
Line 27: Unexpected errors ['generics_self_basic.py:27: error: Too many arguments for "Shape" [call-arg]']
"""
2 changes: 1 addition & 1 deletion conformance/results/mypy/version.toml
@@ -1,2 +1,2 @@
version = "mypy 1.9.0"
test_duration = 2.3
test_duration = 1.6
40 changes: 20 additions & 20 deletions conformance/results/pyre/dataclasses_usage.toml
Expand Up @@ -4,27 +4,27 @@ Does not report error when field with no default follows field with default.
Incorrectly reports error with InitVar that has default value.
"""
output = """
dataclasses_usage.py:51:5 Missing argument [20]: Call `InventoryItem.__init__` expects argument `unit_price`.
dataclasses_usage.py:52:27 Incompatible parameter type [6]: In call `InventoryItem.__init__`, for 2nd positional argument, expected `float` but got `str`.
dataclasses_usage.py:53:5 Too many arguments [19]: Call `InventoryItem.__init__` expects 3 positional arguments, 4 were provided.
dataclasses_usage.py:73:4 Incompatible attribute type [8]: Attribute `a` declared in class `DC3` has type `InitVar[int]` but is used as type `int`.
dataclasses_usage.py:84:5 Too many arguments [19]: Call `DC4.__init__` expects 1 positional argument, 2 were provided.
dataclasses_usage.py:89:4 Incompatible attribute type [8]: Attribute `a` declared in class `DC5` has type `int` but is used as type `str`.
dataclasses_usage.py:116:0 Uninitialized attribute [13]: Attribute `y` is declared in class `DC8` to have type `int` but is never initialized.
dataclasses_usage.py:127:0 Too many arguments [19]: Call `DC7.__init__` expects 1 positional argument, 2 were provided.
dataclasses_usage.py:130:0 Missing argument [20]: Call `DC8.__init__` expects argument `y`.
dataclasses_usage.py:172:0 Uninitialized attribute [13]: Attribute `x` is declared in class `DC13` to have type `int` but is never initialized.
dataclasses_usage.py:172:0 Uninitialized attribute [13]: Attribute `x_squared` is declared in class `DC13` to have type `int` but is never initialized.
dataclasses_usage.py:179:0 Too many arguments [19]: Call `object.__init__` expects 0 positional arguments, 1 was provided.
dataclasses_usage.py:205:0 Incompatible variable type [9]: v7 is declared to have type `DataclassProto` but is used as type `DC15`.
dataclasses_usage.py:50:5 Missing argument [20]: Call `InventoryItem.__init__` expects argument `unit_price`.
dataclasses_usage.py:51:27 Incompatible parameter type [6]: In call `InventoryItem.__init__`, for 2nd positional argument, expected `float` but got `str`.
dataclasses_usage.py:52:5 Too many arguments [19]: Call `InventoryItem.__init__` expects 3 positional arguments, 4 were provided.
dataclasses_usage.py:72:4 Incompatible attribute type [8]: Attribute `a` declared in class `DC3` has type `InitVar[int]` but is used as type `int`.
dataclasses_usage.py:83:5 Too many arguments [19]: Call `DC4.__init__` expects 1 positional argument, 2 were provided.
dataclasses_usage.py:88:4 Incompatible attribute type [8]: Attribute `a` declared in class `DC5` has type `int` but is used as type `str`.
dataclasses_usage.py:115:0 Uninitialized attribute [13]: Attribute `y` is declared in class `DC8` to have type `int` but is never initialized.
dataclasses_usage.py:126:0 Too many arguments [19]: Call `DC7.__init__` expects 1 positional argument, 2 were provided.
dataclasses_usage.py:129:0 Missing argument [20]: Call `DC8.__init__` expects argument `y`.
dataclasses_usage.py:171:0 Uninitialized attribute [13]: Attribute `x` is declared in class `DC13` to have type `int` but is never initialized.
dataclasses_usage.py:171:0 Uninitialized attribute [13]: Attribute `x_squared` is declared in class `DC13` to have type `int` but is never initialized.
dataclasses_usage.py:178:0 Too many arguments [19]: Call `object.__init__` expects 0 positional arguments, 1 was provided.
dataclasses_usage.py:204:0 Incompatible variable type [9]: v7 is declared to have type `DataclassProto` but is used as type `DC15`.
"""
conformance_automated = "Fail"
errors_diff = """
Lines 59, 62: Expected error (tag 'DC1')
Lines 65, 68: Expected error (tag 'DC2')
Lines 71, 74: Expected error (tag 'DC3')
Line 73: Unexpected errors ['dataclasses_usage.py:73:4 Incompatible attribute type [8]: Attribute `a` declared in class `DC3` has type `InitVar[int]` but is used as type `int`.']
Line 116: Unexpected errors ['dataclasses_usage.py:116:0 Uninitialized attribute [13]: Attribute `y` is declared in class `DC8` to have type `int` but is never initialized.']
Line 172: Unexpected errors ['dataclasses_usage.py:172:0 Uninitialized attribute [13]: Attribute `x` is declared in class `DC13` to have type `int` but is never initialized.', 'dataclasses_usage.py:172:0 Uninitialized attribute [13]: Attribute `x_squared` is declared in class `DC13` to have type `int` but is never initialized.']
Line 205: Unexpected errors ['dataclasses_usage.py:205:0 Incompatible variable type [9]: v7 is declared to have type `DataclassProto` but is used as type `DC15`.']
Lines 58, 61: Expected error (tag 'DC1')
Lines 64, 67: Expected error (tag 'DC2')
Lines 70, 73: Expected error (tag 'DC3')
Line 72: Unexpected errors ['dataclasses_usage.py:72:4 Incompatible attribute type [8]: Attribute `a` declared in class `DC3` has type `InitVar[int]` but is used as type `int`.']
Line 115: Unexpected errors ['dataclasses_usage.py:115:0 Uninitialized attribute [13]: Attribute `y` is declared in class `DC8` to have type `int` but is never initialized.']
Line 171: Unexpected errors ['dataclasses_usage.py:171:0 Uninitialized attribute [13]: Attribute `x` is declared in class `DC13` to have type `int` but is never initialized.', 'dataclasses_usage.py:171:0 Uninitialized attribute [13]: Attribute `x_squared` is declared in class `DC13` to have type `int` but is never initialized.']
Line 204: Unexpected errors ['dataclasses_usage.py:204:0 Incompatible variable type [9]: v7 is declared to have type `DataclassProto` but is used as type `DC15`.']
"""
22 changes: 10 additions & 12 deletions conformance/results/pyre/generics_self_basic.toml
Expand Up @@ -3,22 +3,20 @@ notes = """
Does not understand `Self` type.
"""
output = """
generics_self_basic.py:13:26 Undefined attribute [16]: Module `typing` has no attribute `Self`.
generics_self_basic.py:19:8 Incompatible return type [7]: Expected `Variable[_Self_generics_self_basic_Shape__ (bound to Shape)]` but got `Shape`.
generics_self_basic.py:26:30 Undefined attribute [16]: Module `typing` has no attribute `Self`.
generics_self_basic.py:27:15 Too many arguments [19]: Call `object.__init__` expects 0 positional arguments, 1 was provided.
generics_self_basic.py:32:8 Incompatible return type [7]: Expected `Variable[_Self_generics_self_basic_Shape__ (bound to Shape)]` but got `Shape`.
generics_self_basic.py:39:27 Undefined attribute [16]: Module `typing` has no attribute `Self`.
generics_self_basic.py:57:0 Uninitialized attribute [13]: Attribute `value` is declared in class `Container` to have type `Variable[T]` but is never initialized.
generics_self_basic.py:14:26 Undefined attribute [16]: Module `typing` has no attribute `Self`.
generics_self_basic.py:20:8 Incompatible return type [7]: Expected `Variable[_Self_generics_self_basic_Shape__ (bound to Shape)]` but got `Shape`.
generics_self_basic.py:27:30 Undefined attribute [16]: Module `typing` has no attribute `Self`.
generics_self_basic.py:33:8 Incompatible return type [7]: Expected `Variable[_Self_generics_self_basic_Shape__ (bound to Shape)]` but got `Shape`.
generics_self_basic.py:40:27 Undefined attribute [16]: Module `typing` has no attribute `Self`.
generics_self_basic.py:58:0 Uninitialized attribute [13]: Attribute `value` is declared in class `Container` to have type `Variable[T]` but is never initialized.
generics_self_basic.py:64:25 Undefined or invalid type [11]: Annotation `Self` is not defined as a type.
generics_self_basic.py:80:31 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[T]]` but got `TypeVar`.
"""
conformance_automated = "Fail"
errors_diff = """
Line 13: Unexpected errors ['generics_self_basic.py:13:26 Undefined attribute [16]: Module `typing` has no attribute `Self`.']
Line 26: Unexpected errors ['generics_self_basic.py:26:30 Undefined attribute [16]: Module `typing` has no attribute `Self`.']
Line 27: Unexpected errors ['generics_self_basic.py:27:15 Too many arguments [19]: Call `object.__init__` expects 0 positional arguments, 1 was provided.']
Line 39: Unexpected errors ['generics_self_basic.py:39:27 Undefined attribute [16]: Module `typing` has no attribute `Self`.']
Line 57: Unexpected errors ['generics_self_basic.py:57:0 Uninitialized attribute [13]: Attribute `value` is declared in class `Container` to have type `Variable[T]` but is never initialized.']
Line 14: Unexpected errors ['generics_self_basic.py:14:26 Undefined attribute [16]: Module `typing` has no attribute `Self`.']
Line 27: Unexpected errors ['generics_self_basic.py:27:30 Undefined attribute [16]: Module `typing` has no attribute `Self`.']
Line 40: Unexpected errors ['generics_self_basic.py:40:27 Undefined attribute [16]: Module `typing` has no attribute `Self`.']
Line 58: Unexpected errors ['generics_self_basic.py:58:0 Uninitialized attribute [13]: Attribute `value` is declared in class `Container` to have type `Variable[T]` but is never initialized.']
Line 80: Unexpected errors ['generics_self_basic.py:80:31 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[T]]` but got `TypeVar`.']
"""
2 changes: 1 addition & 1 deletion conformance/results/pyre/version.toml
@@ -1,2 +1,2 @@
version = "pyre 0.9.19"
test_duration = 3.2
test_duration = 4.0
2 changes: 1 addition & 1 deletion conformance/results/pyright/aliases_implicit.toml
Expand Up @@ -7,7 +7,7 @@ aliases_implicit.py:78:29 - error: Too many type arguments provided for "GoodTyp
aliases_implicit.py:79:29 - error: Too many type arguments provided for "GoodTypeAlias8[T@GoodTypeAlias8]"; expected 1 but received 2
aliases_implicit.py:80:24 - error: Expected ParamSpec, ellipsis, or list of types
aliases_implicit.py:81:9 - error: Could not specialize type "GoodTypeAlias12[TFloat@GoodTypeAlias12]"
  Type "str" cannot be assigned to type "float"
  Type "str" is incompatible with type "float"
    "str" is incompatible with "float"
aliases_implicit.py:106:9 - error: Variable not allowed in type expression (reportInvalidTypeForm)
aliases_implicit.py:107:9 - error: Variable not allowed in type expression (reportInvalidTypeForm)
Expand Down
2 changes: 1 addition & 1 deletion conformance/results/pyright/aliases_newtype.toml
Expand Up @@ -2,7 +2,7 @@ conformant = "Pass"
output = """
aliases_newtype.py:11:8 - error: Argument of type "Literal['user']" cannot be assigned to parameter "_x" of type "int" in function "__init__"
  "Literal['user']" is incompatible with "int" (reportArgumentType)
aliases_newtype.py:12:14 - error: Expression of type "Literal[42]" cannot be assigned to declared type "UserId"
aliases_newtype.py:12:14 - error: Expression of type "Literal[42]" is incompatible with declared type "UserId"
  "Literal[42]" is incompatible with "UserId" (reportAssignmentType)
aliases_newtype.py:20:16 - error: Second argument to "isinstance" must be a class or tuple of classes
  Class created with NewType cannot be used with instance and class checks (reportArgumentType)
Expand Down

0 comments on commit c0f9dec

Please sign in to comment.