diff --git a/conformance/README.md b/conformance/README.md index f4510de2..f8cb346e 100644 --- a/conformance/README.md +++ b/conformance/README.md @@ -80,7 +80,7 @@ Note that some type checkers may not run on some platforms. If a type checker fa Different type checkers report errors in different ways (with different wording in error messages and different line numbers or character ranges for errors). This variation makes it difficult to fully automate test validation given that tests will want to check for both false positive and false negative type errors. Some level of manual inspection will therefore be needed to determine whether a type checker is fully conformant with all tests in any given test file. This "scoring" process is required only when the output of a test changes — e.g. when a new version of that type checker is released and the tests are rerun. We assume that the output of a type checker will be the same from one run to the next unless/until a new version is released that fixes or introduces a bug. In this case, the output will need to be manually inspected and the conformance results re-scored for those tests whose output has changed. -Conformance results are reported and summarized for each supported type checker. Currently, results are reported for mypy, pyrefly, pyright, and zuban. It is the goal and desire to add additional type checkers over time. +Conformance results are reported and summarized for each supported type checker. Currently, results are reported for mypy, pyrefly, pyright, zuban and ty. It is the goal and desire to add additional type checkers over time. ## Adding a New Test Case diff --git a/conformance/pyproject.toml b/conformance/pyproject.toml index 9b511933..7483444b 100644 --- a/conformance/pyproject.toml +++ b/conformance/pyproject.toml @@ -9,6 +9,7 @@ dependencies = [ "tomli", "tomlkit", "zuban", + "ty", ] [tool.uv] diff --git a/conformance/results/results.html b/conformance/results/results.html index 058d7e55..f6f30a4f 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -180,8 +180,10 @@

Python Type System Conformance Test Results

pyrefly 0.54.0
+
ty 0.0.21
+ - + Type annotations      annotations_coroutines @@ -189,32 +191,37 @@

Python Type System Conformance Test Results

Pass Pass Pass +Pass      annotations_forward_refs
Partial

Does not report error for a forward reference that is not enclosed in quotes.

Does not report error for use of quoted type with "|" operator (runtime error).

Incorrectly generates error for quoted type defined in class scope.

Pass
Partial

Incorrectly generates error for quoted type defined in class scope.

Partial

Types in quotes incorrectly refer to shadowing class member.

Does not reject some type forms that require quotes.

+
Partial

Does not detect runtime errors from partially stringified PEP-604 unions.

Resolves references in type annotations as referring to end-of-scope types (https://discuss.python.org/t/annotation-string-references-in-class-scope-in-conformance-tests/105439, https://github.com/python/typing/pull/2144)

     annotations_generators
Partial

Does not report incompatible Generator type in `yield from` statement.

Pass Pass
Partial

Does not detect that invalid yield is unreachable

+Unsupported      annotations_methods
Pass*

Type evaluation differs from other type checkers because of ambiguity in the spec related to method bindings.

Pass*

Type evaluation differs from other type checkers because of ambiguity in the spec related to method bindings.

Pass Pass +Pass      annotations_typeexpr Pass Pass Pass Pass +Pass - + Special types in annotations      specialtypes_any @@ -222,32 +229,37 @@

Python Type System Conformance Test Results

Pass Pass Pass +Pass      specialtypes_never Pass Pass Pass Pass +Pass      specialtypes_none Pass Pass Pass Pass +Pass      specialtypes_promotions Pass Pass Pass Pass +Pass      specialtypes_type
Partial

Does not treat `type` same as `type[Any]` for assert_type.

Does not allow access to unknown attributes from object of type `type[Any]`.

Pass Pass Pass +
Partial

Allows arbitrary attributes to be accessed on `TA` where `TA = typing.Type[typing.Any]` or `TA = type[typing.Any]`.

Treats `type` equivalently to `type[object]` rather than `type[typing.Any]`.

- + Generics      generics_base_class @@ -255,182 +267,212 @@

Python Type System Conformance Test Results

Pass Pass Pass +Pass      generics_basic Pass Pass Pass
Partial

Incorrect rejects + between two AnyStr

Constrained type var resolves to subtype instead of explcitly listed constraint

+
Partial

Incorrectly allows constrained type variables to be solved to a union of their constraints.

     generics_defaults Partial Pass Pass Pass +
Partial

Does not forbid a `TypeVar` immediately following a `TypeVarTuple` in a parameter list from having a default.

Does not support `TypeVarTuple`.

Does not fully support defaults for `ParamSpec`s.

     generics_defaults_referential Partial Pass Pass Pass +Pass      generics_defaults_specialization Partial Pass Pass Pass +
Partial

Does not reject subscription of an already-specialized generic class.

     generics_paramspec_basic Pass Pass Pass Pass +
Partial

Does not reject using a bare `ParamSpec` as a type alias value.

Does not support `Concatenate`.

     generics_paramspec_components Pass Pass Pass
Partial

Does not reject usage of args/kwargs for out-of-scope ParamSpec

+
Partial

Incorrectly allows using `*args: P.args` and `**kwargs: P.kwargs` when `P` has not been put into scope by any other parameter annotation or enclosing scope.

Does not support `Concatenate`.

     generics_paramspec_semantics Pass
Pass*

Constraint solver doesn't find common type for two signatures captured by a single ParamSpec (allowed).

Pass Pass +
Partial

Does not support `Concatenate`.

     generics_paramspec_specialization Pass Pass Pass Pass +Pass      generics_scoping Pass Pass Pass
Partial

Does not implement several scoping checks/restrictions for generics

+
Partial

Does not reject `list[T]()` in the global scope, where `T` is an unbound type variable.

Does nto reject `alias: TypeAlias = list[T]` in the body scope of a class generic over a type variable `T`.

     generics_self_advanced
Partial

Does not infer the type of an unannotated `self` parameter to be type `Self`.

Does not retain `Self` when calling method that returns `Self`.

Does not infer the type of an unannotated `cls` parameter to be type `type[Self]`.

Does not retain `Self` when accessing attribute through `type[Self]`.

Pass
Partial

Doesn't allow accessing `Self` in a classmethod

Pass*

Treats attributes not initialized on the class as instance-only

+Pass      generics_self_attributes Pass Pass Pass Pass +Pass      generics_self_basic Pass Pass Pass
Partial

Return annotation of Self allows returning the concrete instance of the current class.

+Pass      generics_self_protocols Pass Pass Pass Pass +Pass      generics_self_usage Pass Pass Pass
Partial

Does not implement some restrictions on where Self can be used

+
Partial

Does not reject `Self` used in a return annotation when `self` is annotated using another type variable.

Does not reject `Self` used in staticmethods or metaclasses.

     generics_syntax_compatibility Pass Pass Pass Pass +Unsupported      generics_syntax_declarations Pass Pass Pass Pass +Pass      generics_syntax_infer_variance
Unsupported

Type parameter syntax not yet supported.

Pass Pass Pass +Unsupported      generics_syntax_scoping
Partial

Does not following runtime scoping rules for type parameters in all cases.

Pass Pass Pass +Pass      generics_type_erasure
Partial

Infers Node[Never] instead of Node[Any] when argument is not provided.

False negative on instance attribute access on type(node).

Pass Pass Pass +
Partial

Does not reject access of generic instance variable from the class object.

     generics_typevartuple_args
Partial

Does not enforce that tuples captured by TypeVarTuple are same type.

Pass Pass Pass +
Partial

Supports PEP-646 unpacked tuples but not TypeVarTuple.

     generics_typevartuple_basic
Partial

Does not enforce that tuples captured by TypeVarTuple are same length.

Does not enforce that tuples captured by TypeVarTuple are same type.

Pass Pass
Partial

TypeVarTuple is pinned too early when calling generic function

+Unsupported      generics_typevartuple_callable Pass Pass Pass Pass +Unsupported      generics_typevartuple_concat Pass Pass Pass Pass +Unsupported      generics_typevartuple_overloads Pass Pass Pass Pass +Pass      generics_typevartuple_specialization
Partial

Incorrectly specializes generic alias that includes a TypeVar and TypeVarTuple if no type arguments are provided.

Rejects specialization of generic type alias defined as a tuple containing a TypeVar.

Pass Pass
Partial

Sometimes specializes to tuple[Any, ...] instead of empty tuple

+Unsupported      generics_typevartuple_unpack Pass Pass Pass Pass +Unsupported      generics_upper_bound
Partial

Does not reject use of type variable within an upper bound.

Pass Pass
Partial

Cannot find a common supertype of `list[int]` and `set[int]` in order to solve a type variable bound to `Sized`.

+Pass      generics_variance
Partial

Does not reject use of class-scoped TypeVar used in a base class when variance is incompatible.

Pass Pass Pass +Unsupported      generics_variance_inference Pass Pass Pass Pass +Pass - + Type qualifiers      qualifiers_annotated @@ -438,20 +480,23 @@

Python Type System Conformance Test Results

Pass Pass
Partial

Allows Annotated in some contexts where it should not be allowed

+Pass      qualifiers_final_annotation
Partial

Does not treat use of Final name as if it was replaced by the literal in NamedTuple definition.

Does not allow conditional assignment of Final instance variable in __init__ method.

Does not allow redefinition of private class variable that is marked Final in parent class.

Does not report modification of local Final variable via "for" statement.

Pass Pass
Partial

Final attributes not initialized on the class can be assigned to

+
Partial

Does not forbid `Final`-annotated assignments to attributes on `self` in non-`__init__` methods.

Does not flag modifications of `Final`-annotated attributes via augmented assignment.

     qualifiers_final_decorator Pass Pass Pass Pass +Pass - + Class type compatibility      classes_classvar @@ -459,14 +504,16 @@

Python Type System Conformance Test Results

Pass Pass Pass +Pass      classes_override Pass Pass Pass Pass +Pass - + Type aliases      aliases_explicit @@ -474,44 +521,51 @@

Python Type System Conformance Test Results

Pass Pass Pass +
Partial

`Concatenate` in type aliases is currently unsupported

     aliases_implicit Pass Pass Pass
Partial

Does not reject invalid syntax in implicit type aliases.

+
Partial

Does not reject variables with `Any` or `Unknown` types when used as implicit type aliases.

Does not support `Concatenate` in type aliases.

     aliases_newtype
Partial

`NewType`s are incorrectly considered to be classes.

Pass Pass Pass +Pass      aliases_recursive Pass Pass Pass Pass +Unsupported      aliases_type_statement
Partial

Does not reject type alias defined in function scope.

Pass Pass Pass +
Partial

Does not reject use of the `type` statement inside functions.

Does not reject circular definitions of type aliases.

Does not reject redeclarations of type aliases.

Does not support `type` statements generic over `TypeVarTuple`s.

     aliases_typealiastype
Partial

Incorrectly rejects some recursive type aliases using TypeAliasType.

Incorrectly rejects the use of a class-scoped TypeVar in a TypeAliasType definition.

Pass Pass Pass +
Partial

Does not reject specializing a type parameter in a generic type alias with a type inconsistent with the parameter's upper bound.

Does not reject declaring a type alias with a type variable that is not in scope.

Does not reject declaring a type alias with a non-literal tuple passed to the `type_params` parameter.

Does not reject cyclically defined type aliases.

     aliases_variance Pass Pass Pass Pass +Unsupported - + Literals      literals_interactions @@ -519,26 +573,30 @@

Python Type System Conformance Test Results

Pass Pass Pass +
Partial

Deliberately does not allow `str` to be narrowed to literal string types through equality or containment checks due to the possibility of `str` subclasses that could have unexpected equality semantics.

     literals_literalstring
Unsupported

Support for `LiteralString` is not implemented.

Pass Pass Pass +Pass      literals_parameterizations
Partial

Does not reject tuple within Literal.

Pass Pass Pass +Pass      literals_semantics Pass Pass Pass Pass +Pass - + Protocols      protocols_class_objects @@ -546,68 +604,79 @@

Python Type System Conformance Test Results

Pass Pass Pass +
Unsupported

`type[Proto]` is not yet supported.

`ClassVar` protocol members are not yet supported.

`@property` protocol members are only partially supported.

A class object `C` is only considered to inhabit a protocol type with a method member `f` if `f` exists as an attribute on the metaclass of `C`.

     protocols_definition
Partial

Does not detect protocol mismatch if concrete method is missing annotations.

Does not detect protocol mismatch if concrete method's parameters are position-only.

Pass Pass Pass +
Partial

Does not reject implicit instance attributes in `Protocol` methods.

Does not support `ClassVar` protocol members.

Incorrectly considers `ClassVar` attributes on concrete classes as satisfying non-`ClassVar` attribute members on protocols.

Only has partial support for `@property` protocol members.

     protocols_explicit
Pass*

Does not report unimplemented attributes for class that explicitly derives from protocol until it is instantiated.

Pass Pass Pass +
Unsupported

Allows implicitly abstract protocol methods to be called via `super()` on a protocol subclass.

Allows instantiation of abstract subclasses of protocol classes.

     protocols_generic Pass Pass Pass Pass +
Partial

Only partially supports `@property` protocol members.

     protocols_merging Pass Pass Pass Pass +
Partial

Does not reject attempted instantiation of abstract subclasses of protocols.

     protocols_modules Pass Pass Pass
Partial

Fails one subtyping example of protocol modules

+
Partial

Never considers a module as satisfying a protocol with a method member due to the fact that the method will never exist on the class `types.ModuleType`, only on a given specific module instance.

     protocols_recursive Pass Pass Pass Pass +
Partial

Fails to solve a type variable involving a recursive generic protocol.

     protocols_runtime_checkable
Partial

Does not report unsafe overlap for runtime_checkable protocol.

Pass Pass Pass +
Partial

Does not reject `isinstance()` or `issubclass()` calls against runtime-checkable protocols where there is an unsafe overlap between the type of the first argument and the protocol.

     protocols_self Pass Pass Pass Pass +Pass      protocols_subtyping Pass Pass Pass Pass +Pass      protocols_variance Pass Pass Pass Pass +Unsupported - + Callables      callables_annotation @@ -615,26 +684,30 @@

Python Type System Conformance Test Results

Pass Pass
Partial

Parameter names are lost when resolving ParamSpec

+
Partial

Does not support `Concatenate`.

Infers a callback protocol as being a gradual type if the callback has signature `__call__[T](self, *args: T, **kwargs: T)` and `T` has been explicitly specialized to `Any`.

Does not infer a callback protocol as being a gradual type if the callback has signature `__call__(self, a: int, /, *args: Any, **kwargs: Any)`.

     callables_kwargs
Partial

Allows callable without kwargs to be assigned to callable with unpacked kwargs

Pass Pass Pass +Unsupported      callables_protocol Pass Pass Pass Pass +Pass      callables_subtyping Pass Pass Pass Pass +Pass - + Constructors      constructors_call_init @@ -642,38 +715,44 @@

Python Type System Conformance Test Results

Pass Pass Pass +
Partial

Does not reject invalid argument types to an inherited constructor in a specialized subclass of a generic superclass.

Does not reject class-scoped type variables used in the `self` annotation.

Does not support inferring type variables for generic classes where the `__init__` method uses method-scoped type variables.

     constructors_call_metaclass
Unupported

Does not honor metaclass __call__ method when evaluating constructor call.

Does not skip evaluation of __new__ and __init__ if custom metaclass call returns non-class.

Pass Pass Pass +Unsupported      constructors_call_new
Partial

Does not support __new__ return type that is not a subclass of the class being constructed.

Does not skip evaluation of __init__ based on __new__ return type.

Does not report errors during binding to cls parameter of __new__ method.

Pass Pass Pass +Unsupported      constructors_call_type
Partial

Does not validate call to custom metaclass __call__ method through type[T].

Pass Pass Pass +
Partial

Does not support metaclass `__call__`.

Has overly lenient handling of calls to `type[T]` if `T` is a type variable without an upper bound.

     constructors_callable
Partial

Does not generate a union type for __new__ and __init__ when converting class to callable.

Does not ignore __init__ based on __new__ return type when converting class to callable.

Does not support __new__ return type that is different from class being constructed.

Pass Pass
Partial

Converting constructor to callable does not preserve class-scoped type params.

Converting constructor to callable does not substitute Self in __new__

Converting constructor to callable uses __new__ signature instead of __init__

+
Partial

Does not include `__init__` when `__new__` returns `Self`.

Does not respect `NoReturn` return type on metaclass `__call__`.

Does not ignore `__init__` when `__new__` returns `Any`.

Unions overload return types.

     constructors_consistency
Pass*

Does not report inconsistency between __new__ and __init__ (optional).

Pass Pass Pass +Pass - + Overloads      overloads_basic @@ -681,32 +760,37 @@

Python Type System Conformance Test Results

Pass Pass Pass +Pass      overloads_consistency Pass Pass Pass Pass +Unsupported      overloads_definitions
Partial

Allows @override to be on all overloads and implementation, instead of just implementation.

Pass Pass Pass +Pass      overloads_definitions_stub
Partial

Allows @override to appear in a stub file not on the first overload.

Pass Pass Pass +Pass      overloads_evaluation
Partial

Does not expand boolean arguments to Literal[True] and Literal[False].

Does not expand enum arguments to literal variants.

Does not expand tuple arguments to possible combinations.

Does not evaluate Any in some cases where overload is ambiguous.

Evaluates Any in some cases where overload is not ambiguous.

Partial

Does not evaluate Any in some cases where overload is ambiguous.

Pass Pass +Pass - + Exceptions      exceptions_context_managers @@ -714,8 +798,9 @@

Python Type System Conformance Test Results

Pass Pass
Partial

Some error suppressing context managers are not detected

+Unsupported - + Dataclasses      dataclasses_descriptors @@ -723,98 +808,114 @@

Python Type System Conformance Test Results

Pass Pass
Partial

* Assumes descriptor behavior only when field is assigned in class body

* Doesn't allow non-data descriptors or data descriptors with differing `__get__` and `__set__` types

+
Partial

Only infers a descriptor `__get__` method as being called when a descriptor attribute is accessed on an instance if the descriptor attribute is present in the class namespace.

     dataclasses_final
Partial

Wrongly requires a Final dataclass field to be initialized at class level.

Doesn't support Final nested inside ClassVar.

Pass Pass Pass +Pass      dataclasses_frozen Pass Pass Pass Pass +Pass      dataclasses_hash
Unsupported

Does not synthesize `__hash__ = None` as a class attribute for unhashable dataclasses.

Does not report when an unhashable dataclass has `__hash__` called directly on an instance.

Does not report when dataclass is not compatible with Hashable protocol.

Pass
Partial

Does not synthesize a `__hash__ = None` class attribute for unhashable dataclasses.

Pass +
Partial

Understands the `Hashable` protocol as equivalent to `object`.

     dataclasses_inheritance Pass Pass Pass Pass +
Unsupported

Currently only enforces the Liskov Substitution Principle for methods.

     dataclasses_kwonly Pass Pass Pass Pass +Pass      dataclasses_match_args Pass Pass Pass Pass +
Pass*

Infers `__match_args__` as having type `tuple[()] | Unknown` for `__match_args__ = ()`

     dataclasses_order Pass Pass Pass Pass +Pass      dataclasses_postinit Pass Pass Pass Pass +Pass      dataclasses_slots
Partial

Does not reject write to instance variable that is not defined in __slots__.

Pass Pass
Partial

__slots__ is generated but not checked during attribute assignment

+
Partial

Synthesizes a `__slots__` attribute but does not validate attribute assignments against `__slots__`.

     dataclasses_transform_class Pass Pass Pass Pass +Pass      dataclasses_transform_converter
Unsupported

Converter parameter not yet supported.

Pass Pass Pass +Unsupported      dataclasses_transform_field
Partial

Does not properly handle field constructor that has default value for `kw_only` or `init` parameter.

Pass Pass Pass +Pass      dataclasses_transform_func
Partial

Does not handle `kw_only=False` override when `kw_only_default=True`.

Does not report error when `order=False` and comparison operators are used.

Pass Pass Pass +Pass      dataclasses_transform_meta Pass Pass Pass Pass +Pass      dataclasses_usage
Pass*

Does not detect unannotated usage of `dataclasses.field()`.

Pass Pass Pass +Pass - + Typed dictionaries      typeddicts_alt_syntax @@ -822,86 +923,100 @@

Python Type System Conformance Test Results

Pass Pass Pass +Unsupported      typeddicts_class_syntax Pass Pass Pass Pass +Pass      typeddicts_extra_items
Unsupported

Not supported.

Pass Pass Pass +Unsupported      typeddicts_final Pass Pass Pass Pass +Pass      typeddicts_inheritance Pass Pass Pass Pass +
Partial

Does not validate overrides of `TypedDict` fields in subclasses.

     typeddicts_operations Pass Pass Pass Pass +Pass      typeddicts_readonly Pass Pass Pass Pass +
Partial

Supports `ReadOnly`, but not the functional syntax for `TypedDict`s currently, leading to one assertion failing.

     typeddicts_readonly_consistency Pass Pass Pass Pass +Pass      typeddicts_readonly_inheritance
Partial

Incorrectly rejects non-ReadOnly override of ReadOnly item.

Incorrectly rejects override of ReadOnly item with another ReadOnly item with narrower type.

Incorrectly rejects override of NotRequired ReadOnly item with a Required ReadOnly item.

Pass Pass Pass +
Partial

Does not validate overrides of `TypedDict` keys.

     typeddicts_readonly_kwargs Pass Pass Pass Pass +Unsupported      typeddicts_readonly_update
Partial

Incorrectly allows update of ReadOnly item.

Incorrectly rejects update involving an item with Never type.

Pass Pass Pass +Unsupported      typeddicts_required Pass Pass Pass Pass +Pass      typeddicts_type_consistency Pass Pass Pass Pass +Pass      typeddicts_usage Pass Pass Pass Pass +Pass - + Tuples      tuples_type_compat @@ -909,20 +1024,23 @@

Python Type System Conformance Test Results

Partial

Incorrectly marks a match case as unreachable.

Pass Pass +Pass      tuples_type_form Pass Pass Pass Pass +Pass      tuples_unpacked
Partial

"More than one unpack" error is missing in some cases.

Pass Pass Pass +Pass - + Named tuples      namedtuples_define_class @@ -930,26 +1048,30 @@

Python Type System Conformance Test Results

Pass Pass Pass +
Partial

Permits subclasses of `NamedTuple` classes to override read-only attributes in the class body of the subclass.

     namedtuples_define_functional Pass Pass Pass Pass +Pass      namedtuples_type_compat Pass Pass Pass Pass +Pass      namedtuples_usage
Partial

Does not reject attempt to delete named tuple field by name.

Pass Pass Pass +
Partial

Does not detect runtime errors from attempting to delete namedtuple attributes.

- + Enumerations      enums_behaviors @@ -957,38 +1079,44 @@

Python Type System Conformance Test Results

Pass Pass Pass +Pass      enums_definition Pass Pass Pass Pass +Pass      enums_expansion
Partial

Improperly applies narrowing to Flag subclass.

Pass Pass Pass +
Partial

Does not support `enum.Flag`.

     enums_member_names
Pass*

Does not support special-cased handling of member name literal types in some cases (optional).

Pass Pass Pass +Pass      enums_member_values
Partial

Does not enforce declared type of `_value_`.

Does not enforce assigned tuple types for enum members (optional).

Pass Pass Pass +Pass      enums_members
Partial

Does not treat attribute with annotation and no assignment as non-member.

Does not treat callables as non-members.

Does not honor `enum.member` as method decorator.

Does not properly handle aliased enum members.

Does not support `_ignore_` mechanism (optional).

Does not treat attributes with private names as non-members.

Pass*

Does not support `_ignore_` mechanism (optional).

Pass Pass +Pass - + Type narrowing      narrowing_typeguard @@ -996,14 +1124,16 @@

Python Type System Conformance Test Results

Pass Pass Pass +Pass      narrowing_typeis Pass Pass Pass Pass +
Partial

Intersects the pre-existing type with the top materialization of the bracketed type rather than the bracketed type itself.

- + Type checker directives      directives_assert_type @@ -1011,62 +1141,72 @@

Python Type System Conformance Test Results

Pass Pass Pass +Pass      directives_cast Pass Pass Pass Pass +Pass      directives_deprecated Pass Pass Pass Pass +
Partial

Does not detect calls to deprecated overloads.

Does not detect implicit calls to deprecated dunder methods, for example via operators.

Does not detect accesses of, or attempts to set, deprecated properties.

     directives_no_type_check
Partial

Does not honor `@no_type_check` class decorator (allowed).

Does not reject invalid call of `@no_type_check` function.

Pass*

Does not honor `@no_type_check` class decorator (allowed).

Pass Pass +Pass      directives_reveal_type Pass Pass Pass Pass +Pass      directives_type_checking Pass Pass Pass Pass +
Partial

Attempts to detect some errors even in blocks it determines to be unreachable, including in `if not TYPE_CHECKING` blocks.

     directives_type_ignore
Partial

Does not honor "# type: ignore" comment if comment includes additional text.

Pass
Partial

Does not honor "# type: ignore" comment if comment includes additional text.

Pass +Pass      directives_type_ignore_file1 Pass Pass Pass Pass +Pass      directives_type_ignore_file2 Pass Pass Pass Pass +Pass      directives_version_platform
Pass*

Does not understand three-element form of sys.version checks.

Does not understand os.name checks.

Pass Pass Pass +Pass - + Historical and deprecated features      historical_positional @@ -1074,6 +1214,7 @@

Python Type System Conformance Test Results

Pass Pass Pass +Pass diff --git a/conformance/results/ty/aliases_explicit.toml b/conformance/results/ty/aliases_explicit.toml new file mode 100644 index 00000000..07ed552a --- /dev/null +++ b/conformance/results/ty/aliases_explicit.toml @@ -0,0 +1,30 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = "`Concatenate` in type aliases is currently unsupported" +errors_diff = """ +Line 87: Expected 1 errors +Line 100: Expected 1 errors +Line 57: Unexpected errors ['aliases_explicit.py:57:5: error[type-assertion-failure] Type `Unknown` does not match asserted type `(int, str, str, /) -> None`'] +""" +output = """ +aliases_explicit.py:57:5: error[type-assertion-failure] Type `Unknown` does not match asserted type `(int, str, str, /) -> None` +aliases_explicit.py:67:9: error[not-subscriptable] Cannot subscript non-generic type `` +aliases_explicit.py:68:9: error[not-subscriptable] Cannot subscript non-generic type `` +aliases_explicit.py:69:29: error[invalid-type-arguments] Too many type arguments: expected 1, got 2 +aliases_explicit.py:70:29: error[invalid-type-arguments] Too many type arguments: expected 1, got 2 +aliases_explicit.py:71:24: error[invalid-type-arguments] Type argument for `ParamSpec` must be either a list of types, `ParamSpec`, `Concatenate`, or `...` +aliases_explicit.py:79:1: error[invalid-type-form] Invalid right-hand side for `typing.TypeAlias` assignment +aliases_explicit.py:80:1: error[invalid-type-form] Invalid right-hand side for `typing.TypeAlias` assignment +aliases_explicit.py:81:1: error[invalid-type-form] Invalid right-hand side for `typing.TypeAlias` assignment +aliases_explicit.py:82:1: error[invalid-type-form] Invalid right-hand side for `typing.TypeAlias` assignment +aliases_explicit.py:83:1: error[invalid-type-form] Invalid right-hand side for `typing.TypeAlias` assignment +aliases_explicit.py:84:1: error[invalid-type-form] Invalid right-hand side for `typing.TypeAlias` assignment +aliases_explicit.py:85:1: error[invalid-type-form] Invalid right-hand side for `typing.TypeAlias` assignment +aliases_explicit.py:86:1: error[invalid-type-form] Invalid right-hand side for `typing.TypeAlias` assignment +aliases_explicit.py:88:1: error[invalid-type-form] Invalid right-hand side for `typing.TypeAlias` assignment +aliases_explicit.py:89:1: error[invalid-type-form] Invalid right-hand side for `typing.TypeAlias` assignment +aliases_explicit.py:90:1: error[invalid-type-form] Invalid right-hand side for `typing.TypeAlias` assignment +aliases_explicit.py:91:1: error[invalid-type-form] Invalid right-hand side for `typing.TypeAlias` assignment +aliases_explicit.py:101:6: error[call-non-callable] Object of type `UnionType` is not callable +aliases_explicit.py:102:5: error[not-subscriptable] Cannot subscript non-generic type `` +""" diff --git a/conformance/results/ty/aliases_implicit.toml b/conformance/results/ty/aliases_implicit.toml new file mode 100644 index 00000000..bda01861 --- /dev/null +++ b/conformance/results/ty/aliases_implicit.toml @@ -0,0 +1,34 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not reject variables with `Any` or `Unknown` types when used as implicit type aliases. +Does not support `Concatenate` in type aliases. +""" +errors_diff = """ +Line 106: Expected 1 errors +Line 111: Expected 1 errors +Line 112: Expected 1 errors +Line 113: Expected 1 errors +Line 117: Expected 1 errors +Line 68: Unexpected errors ['aliases_implicit.py:68:5: error[type-assertion-failure] Type `Unknown` does not match asserted type `(int, str, str, /) -> None`'] +""" +output = """ +aliases_implicit.py:68:5: error[type-assertion-failure] Type `Unknown` does not match asserted type `(int, str, str, /) -> None` +aliases_implicit.py:76:9: error[not-subscriptable] Cannot subscript non-generic type `` +aliases_implicit.py:77:9: error[not-subscriptable] Cannot subscript non-generic type `` +aliases_implicit.py:78:29: error[invalid-type-arguments] Too many type arguments: expected 1, got 2 +aliases_implicit.py:79:29: error[invalid-type-arguments] Too many type arguments: expected 1, got 2 +aliases_implicit.py:80:24: error[invalid-type-arguments] Type argument for `ParamSpec` must be either a list of types, `ParamSpec`, `Concatenate`, or `...` +aliases_implicit.py:81:25: error[invalid-type-arguments] Type `str` is not assignable to upper bound `int | float` of type variable `TFloat@GoodTypeAlias12` +aliases_implicit.py:107:9: error[invalid-type-form] Variable of type `list[ | ]` is not allowed in a type expression +aliases_implicit.py:108:9: error[invalid-type-form] Variable of type `tuple[tuple[, ]]` is not allowed in a type expression +aliases_implicit.py:109:9: error[invalid-type-form] Variable of type `list[]` is not allowed in a type expression +aliases_implicit.py:110:9: error[invalid-type-form] Variable of type `dict[str, str]` is not allowed in a type expression +aliases_implicit.py:114:9: error[invalid-type-form] Variable of type `Literal[3]` is not allowed in a type expression +aliases_implicit.py:115:10: error[invalid-type-form] Variable of type `Literal[True]` is not allowed in a type expression +aliases_implicit.py:116:10: error[invalid-type-form] Variable of type `Literal[1]` is not allowed in a type expression +aliases_implicit.py:118:10: error[invalid-type-form] Variable of type `Literal["int"]` is not allowed in a type expression +aliases_implicit.py:119:10: error[invalid-type-form] Variable of type `Literal["int | str"]` is not allowed in a type expression +aliases_implicit.py:133:6: error[call-non-callable] Object of type `UnionType` is not callable +aliases_implicit.py:135:5: error[not-subscriptable] Cannot subscript non-generic type `` +""" diff --git a/conformance/results/ty/aliases_newtype.toml b/conformance/results/ty/aliases_newtype.toml new file mode 100644 index 00000000..92a9a409 --- /dev/null +++ b/conformance/results/ty/aliases_newtype.toml @@ -0,0 +1,19 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +aliases_newtype.py:11:8: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["user"]` +aliases_newtype.py:12:14: error[invalid-assignment] Object of type `Literal[42]` is not assignable to `UserId` +aliases_newtype.py:18:11: error[invalid-assignment] Object of type `` is not assignable to `type` +aliases_newtype.py:23:16: error[invalid-argument-type] Argument to function `isinstance` is incorrect: Expected `type | UnionType | tuple[Divergent, ...]`, found `` +aliases_newtype.py:26:21: error[invalid-base] Cannot subclass an instance of NewType +aliases_newtype.py:35:1: error[invalid-newtype] The name of a `NewType` (`BadName`) must match the name of the variable it is assigned to (`GoodName`) +aliases_newtype.py:41:6: error[invalid-type-form] `GoodNewType1` is a `NewType` and cannot be specialized +aliases_newtype.py:47:38: error[invalid-newtype] invalid base for `typing.NewType`: type `int | str` +aliases_newtype.py:50:38: error[invalid-newtype] invalid base for `typing.NewType`: A `NewType` base cannot be generic +aliases_newtype.py:52:38: error[invalid-newtype] invalid base for `typing.NewType`: type `Hashable` +aliases_newtype.py:54:38: error[invalid-newtype] invalid base for `typing.NewType`: type `Literal[7]` +aliases_newtype.py:61:38: error[invalid-newtype] invalid base for `typing.NewType`: type `TD1` +aliases_newtype.py:63:15: error[invalid-newtype] Wrong number of arguments in `NewType` creation: expected 2, found 3 +aliases_newtype.py:65:38: error[invalid-newtype] invalid base for `typing.NewType`: type `Any` +""" diff --git a/conformance/results/ty/aliases_recursive.toml b/conformance/results/ty/aliases_recursive.toml new file mode 100644 index 00000000..b74c97b2 --- /dev/null +++ b/conformance/results/ty/aliases_recursive.toml @@ -0,0 +1,17 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 19: Expected 1 errors +Line 20: Expected 1 errors +Line 38: Expected 1 errors +Line 39: Expected 1 errors +Line 50: Expected 1 errors +Line 51: Expected 1 errors +Line 52: Expected 1 errors +Line 63: Expected 1 errors +Line 69: Expected 1 errors +Line 72: Expected 1 errors +Line 75: Expected 1 errors +""" +output = """ +""" diff --git a/conformance/results/ty/aliases_type_statement.toml b/conformance/results/ty/aliases_type_statement.toml new file mode 100644 index 00000000..420c17ee --- /dev/null +++ b/conformance/results/ty/aliases_type_statement.toml @@ -0,0 +1,45 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not reject use of the `type` statement inside functions. +Does not reject circular definitions of type aliases. +Does not reject redeclarations of type aliases. +Does not support `type` statements generic over `TypeVarTuple`s. +""" +errors_diff = """ +Line 56: Expected 1 errors +Line 84: Expected 1 errors +Lines 51, 52: Expected error (tag 'TA14') +Line 10: Unexpected errors ['aliases_type_statement.py:10:52: error[invalid-type-arguments] Too many type arguments: expected 2, got 3', 'aliases_type_statement.py:10:52: error[invalid-type-form] `...` is not allowed in this context in a type expression'] +""" +output = """ +aliases_type_statement.py:10:52: error[invalid-type-arguments] Too many type arguments: expected 2, got 3 +aliases_type_statement.py:10:52: error[invalid-type-form] `...` is not allowed in this context in a type expression +aliases_type_statement.py:17:1: error[unresolved-attribute] Object of type `TypeAliasType` has no attribute `bit_count` +aliases_type_statement.py:19:1: error[call-non-callable] Object of type `TypeAliasType` is not callable +aliases_type_statement.py:23:7: error[unresolved-attribute] Object of type `TypeAliasType` has no attribute `other_attrib` +aliases_type_statement.py:26:18: error[invalid-base] Invalid class base with type `TypeAliasType` +aliases_type_statement.py:31:22: error[invalid-argument-type] Argument to function `isinstance` is incorrect: Expected `type | UnionType | tuple[Divergent, ...]`, found `TypeAliasType` +aliases_type_statement.py:37:22: error[invalid-type-form] Function calls are not allowed in type expressions +aliases_type_statement.py:38:22: error[invalid-type-form] List literals are not allowed in this context in a type expression: Did you mean `tuple[int, str]`? +aliases_type_statement.py:39:22: error[invalid-type-form] Tuple literals are not allowed in this context in a type expression +aliases_type_statement.py:39:23: error[invalid-type-form] Tuple literals are not allowed in this context in a type expression: Did you mean `tuple[int, str]`? +aliases_type_statement.py:40:22: error[invalid-type-form] List comprehensions are not allowed in type expressions +aliases_type_statement.py:41:22: error[invalid-type-form] Dict literals are not allowed in type expressions +aliases_type_statement.py:42:22: error[invalid-type-form] Function calls are not allowed in type expressions +aliases_type_statement.py:43:22: error[invalid-type-form] Invalid subscript of object of type `list[]` in type expression +aliases_type_statement.py:43:28: error[invalid-type-form] Int literals are not allowed in this context in a type expression +aliases_type_statement.py:44:22: error[invalid-type-form] `if` expressions are not allowed in type expressions +aliases_type_statement.py:45:22: error[invalid-type-form] Variable of type `Literal[1]` is not allowed in a type expression +aliases_type_statement.py:46:23: error[invalid-type-form] Boolean literals are not allowed in this context in a type expression +aliases_type_statement.py:47:23: error[invalid-type-form] Int literals are not allowed in this context in a type expression +aliases_type_statement.py:48:23: error[invalid-type-form] Boolean operations are not allowed in type expressions +aliases_type_statement.py:49:23: error[fstring-type-annotation] Type expressions cannot use f-strings +aliases_type_statement.py:62:23: error[unbound-type-variable] Type variable `V` is not bound to any outer generic context +aliases_type_statement.py:67:17: error[unbound-type-variable] Type variable `T1` is not bound to any outer generic context +aliases_type_statement.py:77:27: error[invalid-type-arguments] Type `str` is not assignable to upper bound `int` of type variable `S@RecursiveTypeAlias2` +aliases_type_statement.py:79:32: error[invalid-type-arguments] Type `int` is not assignable to upper bound `str` of type variable `T@RecursiveTypeAlias2` +aliases_type_statement.py:82:1: error[cyclic-type-alias-definition] Cyclic definition of `RecursiveTypeAlias3` +aliases_type_statement.py:88:1: error[cyclic-type-alias-definition] Cyclic definition of `RecursiveTypeAlias6` +aliases_type_statement.py:89:1: error[cyclic-type-alias-definition] Cyclic definition of `RecursiveTypeAlias7` +""" diff --git a/conformance/results/ty/aliases_typealiastype.toml b/conformance/results/ty/aliases_typealiastype.toml new file mode 100644 index 00000000..0d4317cc --- /dev/null +++ b/conformance/results/ty/aliases_typealiastype.toml @@ -0,0 +1,36 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not reject specializing a type parameter in a generic type alias with a type inconsistent with the parameter's upper bound. +Does not reject declaring a type alias with a type variable that is not in scope. +Does not reject declaring a type alias with a non-literal tuple passed to the `type_params` parameter. +Does not reject cyclically defined type aliases. +""" +errors_diff = """ +Line 40: Expected 1 errors +Line 43: Expected 1 errors +Line 44: Expected 1 errors +Line 45: Expected 1 errors +Line 46: Expected 1 errors +Line 47: Expected 1 errors +Line 48: Expected 1 errors +""" +output = """ +aliases_typealiastype.py:32:7: error[unresolved-attribute] Object of type `TypeAliasType` has no attribute `other_attrib` +aliases_typealiastype.py:52:40: error[invalid-type-form] Function calls are not allowed in type expressions +aliases_typealiastype.py:53:40: error[invalid-type-form] List literals are not allowed in this context in a type expression: Did you mean `tuple[int, str]`? +aliases_typealiastype.py:54:42: error[invalid-type-form] Tuple literals are not allowed in this context in a type expression +aliases_typealiastype.py:54:43: error[invalid-type-form] Tuple literals are not allowed in this context in a type expression: Did you mean `tuple[int, str]`? +aliases_typealiastype.py:55:42: error[invalid-type-form] List comprehensions are not allowed in type expressions +aliases_typealiastype.py:56:42: error[invalid-type-form] Dict literals are not allowed in type expressions +aliases_typealiastype.py:57:42: error[invalid-type-form] Function calls are not allowed in type expressions +aliases_typealiastype.py:58:42: error[invalid-type-form] Invalid subscript of object of type `list[]` in type expression +aliases_typealiastype.py:58:48: error[invalid-type-form] Int literals are not allowed in this context in a type expression +aliases_typealiastype.py:59:42: error[invalid-type-form] `if` expressions are not allowed in type expressions +aliases_typealiastype.py:60:42: error[invalid-type-form] Variable of type `Literal[3]` is not allowed in a type expression +aliases_typealiastype.py:61:42: error[invalid-type-form] Boolean literals are not allowed in this context in a type expression +aliases_typealiastype.py:62:42: error[invalid-type-form] Int literals are not allowed in this context in a type expression +aliases_typealiastype.py:63:42: error[invalid-type-form] Boolean operations are not allowed in type expressions +aliases_typealiastype.py:64:42: error[invalid-type-form] F-strings are not allowed in type expressions +aliases_typealiastype.py:66:47: error[unresolved-reference] Name `BadAlias21` used when not defined +""" diff --git a/conformance/results/ty/aliases_variance.toml b/conformance/results/ty/aliases_variance.toml new file mode 100644 index 00000000..43595599 --- /dev/null +++ b/conformance/results/ty/aliases_variance.toml @@ -0,0 +1,10 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 24: Expected 1 errors +Line 28: Expected 1 errors +Line 32: Expected 1 errors +Line 44: Expected 1 errors +""" +output = """ +""" diff --git a/conformance/results/ty/annotations_coroutines.toml b/conformance/results/ty/annotations_coroutines.toml new file mode 100644 index 00000000..cdd4d0cd --- /dev/null +++ b/conformance/results/ty/annotations_coroutines.toml @@ -0,0 +1,5 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +""" diff --git a/conformance/results/ty/annotations_forward_refs.toml b/conformance/results/ty/annotations_forward_refs.toml new file mode 100644 index 00000000..15ee0435 --- /dev/null +++ b/conformance/results/ty/annotations_forward_refs.toml @@ -0,0 +1,41 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not detect runtime errors from partially stringified PEP-604 unions. +Resolves references in type annotations as referring to end-of-scope types (https://discuss.python.org/t/annotation-string-references-in-class-scope-in-conformance-tests/105439, https://github.com/python/typing/pull/2144) +""" +errors_diff = """ +Line 24: Expected 1 errors +Line 25: Expected 1 errors +Line 82: Unexpected errors ['annotations_forward_refs.py:82:11: error[invalid-type-form] Variable of type `Literal[""]` is not allowed in a type expression'] +Line 87: Unexpected errors ['annotations_forward_refs.py:87:9: error[invalid-type-form] Function `int` is not valid in a type expression'] +Line 95: Unexpected errors ['annotations_forward_refs.py:95:1: error[type-assertion-failure] Type `Unknown` does not match asserted type `str`'] +Line 96: Unexpected errors ['annotations_forward_refs.py:96:1: error[type-assertion-failure] Type `Unknown` does not match asserted type `int`'] +""" +output = """ +annotations_forward_refs.py:22:7: error[unresolved-reference] Name `ClassA` used when not defined +annotations_forward_refs.py:23:12: error[unresolved-reference] Name `ClassA` used when not defined +annotations_forward_refs.py:41:10: error[invalid-type-form] Function calls are not allowed in type expressions +annotations_forward_refs.py:42:10: error[invalid-type-form] List literals are not allowed in this context in a type expression: Did you mean `tuple[int, str]`? +annotations_forward_refs.py:43:10: error[invalid-type-form] Tuple literals are not allowed in this context in a type expression: Did you mean `tuple[int, str]`? +annotations_forward_refs.py:44:10: error[invalid-type-form] List comprehensions are not allowed in type expressions +annotations_forward_refs.py:45:10: error[invalid-type-form] Dict literals are not allowed in type expressions +annotations_forward_refs.py:46:10: error[invalid-type-form] Function calls are not allowed in type expressions +annotations_forward_refs.py:47:10: error[invalid-type-form] Invalid subscript of object of type `list[]` in type expression +annotations_forward_refs.py:47:16: error[invalid-type-form] Int literals are not allowed in this context in a type expression +annotations_forward_refs.py:48:10: error[invalid-type-form] `if` expressions are not allowed in type expressions +annotations_forward_refs.py:49:10: error[invalid-type-form] Variable of type `Literal[1]` is not allowed in a type expression +annotations_forward_refs.py:50:11: error[invalid-type-form] Boolean literals are not allowed in this context in a type expression +annotations_forward_refs.py:51:11: error[invalid-type-form] Int literals are not allowed in this context in a type expression +annotations_forward_refs.py:52:11: error[invalid-type-form] Unary operations are not allowed in type expressions +annotations_forward_refs.py:53:11: error[invalid-type-form] Boolean operations are not allowed in type expressions +annotations_forward_refs.py:54:11: error[fstring-type-annotation] Type expressions cannot use f-strings +annotations_forward_refs.py:55:11: error[invalid-type-form] Module `types` is not valid in a type expression +annotations_forward_refs.py:66:26: error[unresolved-reference] Name `ClassB` used when not defined +annotations_forward_refs.py:80:14: error[unresolved-reference] Name `ClassF` used when not defined +annotations_forward_refs.py:82:11: error[invalid-type-form] Variable of type `Literal[""]` is not allowed in a type expression +annotations_forward_refs.py:87:9: error[invalid-type-form] Function `int` is not valid in a type expression +annotations_forward_refs.py:89:8: error[invalid-type-form] Function `int` is not valid in a type expression +annotations_forward_refs.py:95:1: error[type-assertion-failure] Type `Unknown` does not match asserted type `str` +annotations_forward_refs.py:96:1: error[type-assertion-failure] Type `Unknown` does not match asserted type `int` +""" diff --git a/conformance/results/ty/annotations_generators.toml b/conformance/results/ty/annotations_generators.toml new file mode 100644 index 00000000..f2b2b5e2 --- /dev/null +++ b/conformance/results/ty/annotations_generators.toml @@ -0,0 +1,16 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 51: Expected 1 errors +Line 54: Expected 1 errors +Line 57: Expected 1 errors +Line 66: Expected 1 errors +Line 75: Expected 1 errors +Line 118: Expected 1 errors +Line 119: Expected 1 errors +Line 135: Expected 1 errors +""" +output = """ +annotations_generators.py:86:21: error[invalid-return-type] Return type does not match returned value: expected `int`, found `types.GeneratorType` +annotations_generators.py:91:27: error[invalid-return-type] Return type does not match returned value: expected `int`, found `types.AsyncGeneratorType` +""" diff --git a/conformance/results/ty/annotations_methods.toml b/conformance/results/ty/annotations_methods.toml new file mode 100644 index 00000000..5800c037 --- /dev/null +++ b/conformance/results/ty/annotations_methods.toml @@ -0,0 +1,6 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +annotations_methods.py:42:1: error[type-assertion-failure] Type `B` does not match asserted type `A` +""" diff --git a/conformance/results/ty/annotations_typeexpr.toml b/conformance/results/ty/annotations_typeexpr.toml new file mode 100644 index 00000000..4bc31c01 --- /dev/null +++ b/conformance/results/ty/annotations_typeexpr.toml @@ -0,0 +1,21 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +annotations_typeexpr.py:88:9: error[invalid-type-form] Function calls are not allowed in type expressions +annotations_typeexpr.py:89:9: error[invalid-type-form] List literals are not allowed in this context in a type expression: Did you mean `tuple[int, str]`? +annotations_typeexpr.py:90:9: error[invalid-type-form] Tuple literals are not allowed in this context in a type expression: Did you mean `tuple[int, str]`? +annotations_typeexpr.py:91:9: error[invalid-type-form] List comprehensions are not allowed in type expressions +annotations_typeexpr.py:92:9: error[invalid-type-form] Dict literals are not allowed in type expressions +annotations_typeexpr.py:93:9: error[invalid-type-form] Function calls are not allowed in type expressions +annotations_typeexpr.py:94:9: error[invalid-type-form] Invalid subscript of object of type `list[]` in type expression +annotations_typeexpr.py:94:15: error[invalid-type-form] Int literals are not allowed in this context in a type expression +annotations_typeexpr.py:95:9: error[invalid-type-form] `if` expressions are not allowed in type expressions +annotations_typeexpr.py:96:9: error[invalid-type-form] Variable of type `Literal[3]` is not allowed in a type expression +annotations_typeexpr.py:97:10: error[invalid-type-form] Boolean literals are not allowed in this context in a type expression +annotations_typeexpr.py:98:10: error[invalid-type-form] Int literals are not allowed in this context in a type expression +annotations_typeexpr.py:99:10: error[invalid-type-form] Unary operations are not allowed in type expressions +annotations_typeexpr.py:100:10: error[invalid-type-form] Boolean operations are not allowed in type expressions +annotations_typeexpr.py:101:10: error[fstring-type-annotation] Type expressions cannot use f-strings +annotations_typeexpr.py:102:10: error[invalid-type-form] Module `types` is not valid in a type expression +""" diff --git a/conformance/results/ty/callables_annotation.toml b/conformance/results/ty/callables_annotation.toml new file mode 100644 index 00000000..aa616994 --- /dev/null +++ b/conformance/results/ty/callables_annotation.toml @@ -0,0 +1,33 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not support `Concatenate`. +Infers a callback protocol as being a gradual type if the callback has signature `__call__[T](self, *args: T, **kwargs: T)` and `T` has been explicitly specialized to `Any`. +Does not infer a callback protocol as being a gradual type if the callback has signature `__call__(self, a: int, /, *args: Any, **kwargs: Any)`. +""" +errors_diff = """ +Line 91: Expected 1 errors +Line 93: Expected 1 errors +Line 159: Expected 1 errors +Line 172: Expected 1 errors +Line 187: Expected 1 errors +Line 189: Expected 1 errors +Line 157: Unexpected errors ['callables_annotation.py:157:20: error[invalid-assignment] Object of type `Proto7` is not assignable to `Proto6`'] +""" +output = """ +callables_annotation.py:25:5: error[missing-argument] No argument provided for required parameter 2 +callables_annotation.py:26:11: error[invalid-argument-type] Argument is incorrect: Expected `str`, found `Literal[2]` +callables_annotation.py:27:15: error[too-many-positional-arguments] Too many positional arguments: expected 2, got 3 +callables_annotation.py:29:5: error[missing-argument] No arguments provided for required parameters 1, 2 +callables_annotation.py:29:8: error[unknown-argument] Argument `a` does not match any known parameter +callables_annotation.py:29:13: error[unknown-argument] Argument `b` does not match any known parameter +callables_annotation.py:35:8: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 1 +callables_annotation.py:55:5: error[invalid-type-form] Special form `typing.Callable` expected exactly two arguments (parameter types and return type) +callables_annotation.py:55:14: error[invalid-type-form] The first argument to `Callable` must be either a list of types, ParamSpec, Concatenate, or `...` +callables_annotation.py:56:14: error[invalid-type-form] The first argument to `Callable` must be either a list of types, ParamSpec, Concatenate, or `...` +callables_annotation.py:57:18: error[invalid-type-form] List literals are not allowed in this context in a type expression: Did you mean `list[int]`? +callables_annotation.py:58:5: error[invalid-type-form] Special form `typing.Callable` expected exactly two arguments (parameter types and return type) +callables_annotation.py:58:14: error[invalid-type-form] The first argument to `Callable` must be either a list of types, ParamSpec, Concatenate, or `...` +callables_annotation.py:59:14: error[invalid-type-form] `[...]` is not a valid parameter list for `Callable`: Did you mean `Callable[..., int]`? +callables_annotation.py:157:20: error[invalid-assignment] Object of type `Proto7` is not assignable to `Proto6` +""" diff --git a/conformance/results/ty/callables_kwargs.toml b/conformance/results/ty/callables_kwargs.toml new file mode 100644 index 00000000..610256cb --- /dev/null +++ b/conformance/results/ty/callables_kwargs.toml @@ -0,0 +1,28 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 46: Expected 1 errors +Line 51: Expected 1 errors +Line 58: Expected 1 errors +Line 63: Expected 1 errors +Line 65: Expected 1 errors +Line 101: Expected 1 errors +Line 102: Expected 1 errors +Line 111: Expected 1 errors +Line 122: Expected 1 errors +Line 24: Unexpected errors ['callables_kwargs.py:24:5: error[type-assertion-failure] Type `@Todo` does not match asserted type `int`'] +Line 32: Unexpected errors ['callables_kwargs.py:32:9: error[type-assertion-failure] Type `@Todo` does not match asserted type `str`'] +Line 35: Unexpected errors ['callables_kwargs.py:35:5: error[type-assertion-failure] Type `@Todo` does not match asserted type `str`'] +Line 41: Unexpected errors ['callables_kwargs.py:41:5: error[type-assertion-failure] Type `dict[str, @Todo]` does not match asserted type `TD1`'] +""" +output = """ +callables_kwargs.py:24:5: error[type-assertion-failure] Type `@Todo` does not match asserted type `int` +callables_kwargs.py:32:9: error[type-assertion-failure] Type `@Todo` does not match asserted type `str` +callables_kwargs.py:35:5: error[type-assertion-failure] Type `@Todo` does not match asserted type `str` +callables_kwargs.py:41:5: error[type-assertion-failure] Type `dict[str, @Todo]` does not match asserted type `TD1` +callables_kwargs.py:52:11: error[too-many-positional-arguments] Too many positional arguments to function `func1`: expected 0, got 3 +callables_kwargs.py:64:11: error[invalid-argument-type] Argument to function `func2` is incorrect: Expected `str`, found `Literal[1]` +callables_kwargs.py:64:14: error[parameter-already-assigned] Multiple values provided for parameter `v3` of function `func2` +callables_kwargs.py:103:19: error[invalid-assignment] Object of type `def func1(**kwargs: @Todo) -> None` is not assignable to `TDProtocol5` +callables_kwargs.py:134:19: error[invalid-assignment] Object of type `def func7(*, v1: int, v3: str, v2: str = "") -> None` is not assignable to `TDProtocol6` +""" diff --git a/conformance/results/ty/callables_protocol.toml b/conformance/results/ty/callables_protocol.toml new file mode 100644 index 00000000..23b8e9cf --- /dev/null +++ b/conformance/results/ty/callables_protocol.toml @@ -0,0 +1,22 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +callables_protocol.py:35:7: error[invalid-assignment] Object of type `def cb1_bad1(*vals: bytes, *, max_items: int | None) -> list[bytes]` is not assignable to `Proto1` +callables_protocol.py:36:7: error[invalid-assignment] Object of type `def cb1_bad2(*vals: bytes) -> list[bytes]` is not assignable to `Proto1` +callables_protocol.py:37:7: error[invalid-assignment] Object of type `def cb1_bad3(*vals: bytes, *, max_len: str | None) -> list[bytes]` is not assignable to `Proto1` +callables_protocol.py:67:7: error[invalid-assignment] Object of type `def cb2_bad1(*a: bytes) -> Unknown` is not assignable to `Proto2` +callables_protocol.py:68:7: error[invalid-assignment] Object of type `def cb2_bad2(*a: str, **b: str) -> Unknown` is not assignable to `Proto2` +callables_protocol.py:69:7: error[invalid-assignment] Object of type `def cb2_bad3(*a: bytes, **b: bytes) -> Unknown` is not assignable to `Proto2` +callables_protocol.py:70:7: error[invalid-assignment] Object of type `def cb2_bad4(**b: str) -> Unknown` is not assignable to `Proto2` +callables_protocol.py:97:16: error[invalid-assignment] Object of type `def cb4_bad1(x: int) -> None` is not assignable to `Proto4` +callables_protocol.py:121:18: error[invalid-assignment] Object of type `def cb6_bad1(*vals: bytes, *, max_len: int | None = None) -> list[bytes]` is not assignable to `NotProto6` +callables_protocol.py:169:7: error[invalid-assignment] Object of type `def cb8_bad1(x: int) -> Any` is not assignable to `Proto8` +callables_protocol.py:186:5: error[invalid-assignment] Object of type `Literal["str"]` is not assignable to attribute `other_attribute` of type `int` +callables_protocol.py:187:5: error[unresolved-attribute] Unresolved attribute `xxx` on type `Proto9[P@decorator1, R@decorator1]` +callables_protocol.py:197:7: error[unresolved-attribute] Object of type `Proto9[(x: int), str]` has no attribute `other_attribute2` +callables_protocol.py:238:8: error[invalid-assignment] Object of type `def cb11_bad1(x: int, y: str, /) -> Any` is not assignable to `Proto11` +callables_protocol.py:260:8: error[invalid-assignment] Object of type `def cb12_bad1(*args: Any, *, kwarg0: Any) -> None` is not assignable to `Proto12` +callables_protocol.py:284:27: error[invalid-assignment] Object of type `def cb13_no_default(path: str) -> str` is not assignable to `Proto13_Default` +callables_protocol.py:311:27: error[invalid-assignment] Object of type `def cb14_no_default(*, path: str) -> str` is not assignable to `Proto14_Default` +""" diff --git a/conformance/results/ty/callables_subtyping.toml b/conformance/results/ty/callables_subtyping.toml new file mode 100644 index 00000000..d6d67269 --- /dev/null +++ b/conformance/results/ty/callables_subtyping.toml @@ -0,0 +1,37 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +callables_subtyping.py:26:36: error[invalid-assignment] Object of type `(int, /) -> int` is not assignable to `(int | float, /) -> int | float` +callables_subtyping.py:29:32: error[invalid-assignment] Object of type `(int | float, /) -> int | float` is not assignable to `(int, /) -> int` +callables_subtyping.py:51:21: error[invalid-assignment] Object of type `PosOnly2` is not assignable to `Standard2` +callables_subtyping.py:52:21: error[invalid-assignment] Object of type `KwOnly2` is not assignable to `Standard2` +callables_subtyping.py:55:20: error[invalid-assignment] Object of type `KwOnly2` is not assignable to `PosOnly2` +callables_subtyping.py:58:19: error[invalid-assignment] Object of type `PosOnly2` is not assignable to `KwOnly2` +callables_subtyping.py:82:20: error[invalid-assignment] Object of type `NoArgs3` is not assignable to `IntArgs3` +callables_subtyping.py:85:22: error[invalid-assignment] Object of type `NoArgs3` is not assignable to `FloatArgs3` +callables_subtyping.py:86:22: error[invalid-assignment] Object of type `IntArgs3` is not assignable to `FloatArgs3` +callables_subtyping.py:116:20: error[invalid-assignment] Object of type `IntArgs4` is not assignable to `PosOnly4` +callables_subtyping.py:119:23: error[invalid-assignment] Object of type `StrArgs4` is not assignable to `IntStrArgs4` +callables_subtyping.py:120:23: error[invalid-assignment] Object of type `IntArgs4` is not assignable to `IntStrArgs4` +callables_subtyping.py:122:20: error[invalid-assignment] Object of type `IntArgs4` is not assignable to `StrArgs4` +callables_subtyping.py:124:20: error[invalid-assignment] Object of type `StrArgs4` is not assignable to `IntArgs4` +callables_subtyping.py:125:22: error[invalid-assignment] Object of type `IntStrArgs4` is not assignable to `Standard4` +callables_subtyping.py:126:22: error[invalid-assignment] Object of type `StrArgs4` is not assignable to `Standard4` +callables_subtyping.py:151:22: error[invalid-assignment] Object of type `NoKwargs5` is not assignable to `IntKwargs5` +callables_subtyping.py:154:24: error[invalid-assignment] Object of type `NoKwargs5` is not assignable to `FloatKwargs5` +callables_subtyping.py:155:24: error[invalid-assignment] Object of type `IntKwargs5` is not assignable to `FloatKwargs5` +callables_subtyping.py:187:19: error[invalid-assignment] Object of type `IntKwargs6` is not assignable to `KwOnly6` +callables_subtyping.py:190:25: error[invalid-assignment] Object of type `StrKwargs6` is not assignable to `IntStrKwargs6` +callables_subtyping.py:191:25: error[invalid-assignment] Object of type `IntKwargs6` is not assignable to `IntStrKwargs6` +callables_subtyping.py:193:22: error[invalid-assignment] Object of type `IntKwargs6` is not assignable to `StrKwargs6` +callables_subtyping.py:195:22: error[invalid-assignment] Object of type `StrKwargs6` is not assignable to `IntKwargs6` +callables_subtyping.py:196:22: error[invalid-assignment] Object of type `IntStrKwargs6` is not assignable to `Standard6` +callables_subtyping.py:197:22: error[invalid-assignment] Object of type `StrKwargs6` is not assignable to `Standard6` +callables_subtyping.py:236:23: error[invalid-assignment] Object of type `NoDefaultArg8` is not assignable to `DefaultArg8` +callables_subtyping.py:237:23: error[invalid-assignment] Object of type `NoX8` is not assignable to `DefaultArg8` +callables_subtyping.py:240:25: error[invalid-assignment] Object of type `NoX8` is not assignable to `NoDefaultArg8` +callables_subtyping.py:243:16: error[invalid-assignment] Object of type `NoDefaultArg8` is not assignable to `NoX8` +callables_subtyping.py:273:21: error[invalid-assignment] Object of type `Overloaded9` is not assignable to `FloatArg9` +callables_subtyping.py:297:24: error[invalid-assignment] Object of type `StrArg10` is not assignable to `Overloaded10` +""" diff --git a/conformance/results/ty/classes_classvar.toml b/conformance/results/ty/classes_classvar.toml new file mode 100644 index 00000000..67419c86 --- /dev/null +++ b/conformance/results/ty/classes_classvar.toml @@ -0,0 +1,22 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +classes_classvar.py:38:11: error[invalid-type-form] Type qualifier `typing.ClassVar` expected exactly 1 argument, got 2 +classes_classvar.py:39:14: error[invalid-type-form] Int literals are not allowed in this context in a type expression +classes_classvar.py:40:14: error[unresolved-reference] Name `var` used when not defined +classes_classvar.py:45:11: error[invalid-type-form] `ClassVar` cannot contain type variables +classes_classvar.py:46:11: error[invalid-type-form] `ClassVar` cannot contain type variables +classes_classvar.py:47:11: error[invalid-type-form] `ClassVar` cannot contain type variables +classes_classvar.py:52:33: error[invalid-assignment] Object of type `dict[Unknown, Unknown]` is not assignable to `list[str]` +classes_classvar.py:54:11: error[redundant-final-classvar] `Combining `ClassVar` and `Final` is redundant +classes_classvar.py:55:17: error[invalid-type-form] Type qualifier `typing.ClassVar` is not allowed in type expressions (only in annotation expressions) +classes_classvar.py:69:23: error[invalid-type-form] `ClassVar` is not allowed in function parameter annotations +classes_classvar.py:70:12: error[invalid-type-form] `ClassVar` annotations are only allowed in class-body scopes +classes_classvar.py:71:18: error[invalid-type-form] `ClassVar` annotations are not allowed for non-name targets +classes_classvar.py:73:26: error[invalid-type-form] `ClassVar` is not allowed in function return type annotations +classes_classvar.py:77:8: error[invalid-type-form] `ClassVar` annotations are only allowed in class-body scopes +classes_classvar.py:78:20: error[invalid-type-form] Type qualifiers are not allowed in type alias definitions +classes_classvar.py:111:1: error[invalid-attribute-access] Cannot assign to ClassVar `stats` from an instance of type `Starship` +classes_classvar.py:140:13: error[invalid-assignment] Object of type `ProtoAImpl` is not assignable to `ProtoA` +""" diff --git a/conformance/results/ty/classes_override.toml b/conformance/results/ty/classes_override.toml new file mode 100644 index 00000000..52cef47d --- /dev/null +++ b/conformance/results/ty/classes_override.toml @@ -0,0 +1,10 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +classes_override.py:53:9: error[invalid-explicit-override] Method `method3` is decorated with `@override` but does not override anything +classes_override.py:65:9: error[invalid-explicit-override] Method `method4` is decorated with `@override` but does not override anything +classes_override.py:79:9: error[invalid-explicit-override] Method `static_method1` is decorated with `@override` but does not override anything +classes_override.py:84:9: error[invalid-explicit-override] Method `class_method1` is decorated with `@override` but does not override anything +classes_override.py:89:9: error[invalid-explicit-override] Method `property1` is decorated with `@override` but does not override anything +""" diff --git a/conformance/results/ty/constructors_call_init.toml b/conformance/results/ty/constructors_call_init.toml new file mode 100644 index 00000000..3e0fc1e7 --- /dev/null +++ b/conformance/results/ty/constructors_call_init.toml @@ -0,0 +1,20 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not reject invalid argument types to an inherited constructor in a specialized subclass of a generic superclass. +Does not reject class-scoped type variables used in the `self` annotation. +Does not support inferring type variables for generic classes where the `__init__` method uses method-scoped type variables. +""" +errors_diff = """ +Line 42: Expected 1 errors +Line 107: Expected 1 errors +Line 91: Unexpected errors ['constructors_call_init.py:91:1: error[type-assertion-failure] Type `Class6[Unknown, Unknown]` does not match asserted type `Class6[int, str]`'] +Line 99: Unexpected errors ['constructors_call_init.py:99:1: error[type-assertion-failure] Type `Class7[Unknown, Unknown]` does not match asserted type `Class7[str, int]`'] +""" +output = """ +constructors_call_init.py:21:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int`, found `float` +constructors_call_init.py:56:1: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `Class4[int]`, found `Class4[str]` +constructors_call_init.py:91:1: error[type-assertion-failure] Type `Class6[Unknown, Unknown]` does not match asserted type `Class6[int, str]` +constructors_call_init.py:99:1: error[type-assertion-failure] Type `Class7[Unknown, Unknown]` does not match asserted type `Class7[str, int]` +constructors_call_init.py:130:9: error[too-many-positional-arguments] Too many positional arguments to bound method `__init__`: expected 1, got 2 +""" diff --git a/conformance/results/ty/constructors_call_metaclass.toml b/conformance/results/ty/constructors_call_metaclass.toml new file mode 100644 index 00000000..f1ea8725 --- /dev/null +++ b/conformance/results/ty/constructors_call_metaclass.toml @@ -0,0 +1,13 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 39: Unexpected errors ['constructors_call_metaclass.py:39:1: error[type-assertion-failure] Type `Class2` does not match asserted type `int | Meta2`', 'constructors_call_metaclass.py:39:13: error[missing-argument] No argument provided for required parameter `x` of function `__new__`'] +Line 46: Unexpected errors ["constructors_call_metaclass.py:46:16: error[invalid-super-argument] `type[T@__call__]` is not an instance or subclass of `` in `super(, type[T@__call__])` call"] +""" +output = """ +constructors_call_metaclass.py:39:1: error[type-assertion-failure] Type `Class2` does not match asserted type `int | Meta2` +constructors_call_metaclass.py:39:13: error[missing-argument] No argument provided for required parameter `x` of function `__new__` +constructors_call_metaclass.py:46:16: error[invalid-super-argument] `type[T@__call__]` is not an instance or subclass of `` in `super(, type[T@__call__])` call +constructors_call_metaclass.py:54:1: error[missing-argument] No argument provided for required parameter `x` of function `__new__` +constructors_call_metaclass.py:68:1: error[missing-argument] No argument provided for required parameter `x` of function `__new__` +""" diff --git a/conformance/results/ty/constructors_call_new.toml b/conformance/results/ty/constructors_call_new.toml new file mode 100644 index 00000000..c075fbba --- /dev/null +++ b/conformance/results/ty/constructors_call_new.toml @@ -0,0 +1,24 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 49: Unexpected errors ['constructors_call_new.py:49:1: error[type-assertion-failure] Type `Class3` does not match asserted type `int`', 'constructors_call_new.py:49:13: error[missing-argument] No argument provided for required parameter `x` of bound method `__init__`'] +Line 64: Unexpected errors ['constructors_call_new.py:64:1: error[type-assertion-failure] Type `Class4` does not match asserted type `Class4 | Any`', 'constructors_call_new.py:64:13: error[missing-argument] No argument provided for required parameter `x` of bound method `__init__`'] +Line 76: Unexpected errors ['constructors_call_new.py:76:5: error[type-assertion-failure] Type `Class5` does not match asserted type `Never`', 'constructors_call_new.py:76:17: error[missing-argument] No argument provided for required parameter `x` of bound method `__init__`'] +Line 89: Unexpected errors ['constructors_call_new.py:89:1: error[type-assertion-failure] Type `Class6` does not match asserted type `int | Class6`', 'constructors_call_new.py:89:13: error[missing-argument] No argument provided for required parameter `x` of bound method `__init__`'] +Line 117: Unexpected errors ['constructors_call_new.py:117:1: error[type-assertion-failure] Type `Class8[int]` does not match asserted type `Class8[list[int]]`'] +Line 118: Unexpected errors ['constructors_call_new.py:118:1: error[type-assertion-failure] Type `Class8[str]` does not match asserted type `Class8[list[str]]`'] +""" +output = """ +constructors_call_new.py:21:13: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `int`, found `float` +constructors_call_new.py:49:1: error[type-assertion-failure] Type `Class3` does not match asserted type `int` +constructors_call_new.py:49:13: error[missing-argument] No argument provided for required parameter `x` of bound method `__init__` +constructors_call_new.py:64:1: error[type-assertion-failure] Type `Class4` does not match asserted type `Class4 | Any` +constructors_call_new.py:64:13: error[missing-argument] No argument provided for required parameter `x` of bound method `__init__` +constructors_call_new.py:76:5: error[type-assertion-failure] Type `Class5` does not match asserted type `Never` +constructors_call_new.py:76:17: error[missing-argument] No argument provided for required parameter `x` of bound method `__init__` +constructors_call_new.py:89:1: error[type-assertion-failure] Type `Class6` does not match asserted type `int | Class6` +constructors_call_new.py:89:13: error[missing-argument] No argument provided for required parameter `x` of bound method `__init__` +constructors_call_new.py:117:1: error[type-assertion-failure] Type `Class8[int]` does not match asserted type `Class8[list[int]]` +constructors_call_new.py:118:1: error[type-assertion-failure] Type `Class8[str]` does not match asserted type `Class8[list[str]]` +constructors_call_new.py:148:1: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `type[Class11[int]]`, found `` +""" diff --git a/conformance/results/ty/constructors_call_type.toml b/conformance/results/ty/constructors_call_type.toml new file mode 100644 index 00000000..1a77533d --- /dev/null +++ b/conformance/results/ty/constructors_call_type.toml @@ -0,0 +1,19 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not support metaclass `__call__`. +Has overly lenient handling of calls to `type[T]` if `T` is a type variable without an upper bound. +""" +errors_diff = """ +Line 30: Expected 1 errors +Line 64: Expected 1 errors +Line 72: Expected 1 errors +""" +output = """ +constructors_call_type.py:19:55: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive +constructors_call_type.py:40:5: error[missing-argument] No arguments provided for required parameters `x`, `y` of function `__new__` +constructors_call_type.py:50:5: error[missing-argument] No arguments provided for required parameters `x`, `y` of bound method `__init__` +constructors_call_type.py:59:9: error[too-many-positional-arguments] Too many positional arguments to bound method `__init__`: expected 1, got 2 +constructors_call_type.py:81:5: error[missing-argument] No argument provided for required parameter `y` of function `__new__` +constructors_call_type.py:82:12: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str`, found `Literal[2]` +""" diff --git a/conformance/results/ty/constructors_callable.toml b/conformance/results/ty/constructors_callable.toml new file mode 100644 index 00000000..a0e0c6c3 --- /dev/null +++ b/conformance/results/ty/constructors_callable.toml @@ -0,0 +1,50 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not include `__init__` when `__new__` returns `Self`. +Does not respect `NoReturn` return type on metaclass `__call__`. +Does not ignore `__init__` when `__new__` returns `Any`. +Unions overload return types. +""" +errors_diff = """ +Line 66: Expected 1 errors +Line 67: Expected 1 errors +Line 68: Expected 1 errors +Line 102: Unexpected errors ['constructors_callable.py:102:5: error[type-assertion-failure] Type `Unknown` does not match asserted type `Never`'] +Line 107: Unexpected errors ['constructors_callable.py:107:5: error[type-assertion-failure] Type `Unknown` does not match asserted type `Never`'] +Line 143: Unexpected errors ["constructors_callable.py:143:27: error[invalid-argument-type] Argument to function `accepts_callable` is incorrect: Expected `() -> Any | Class6Any`, found ``"] +Line 145: Unexpected errors ['constructors_callable.py:145:1: error[type-assertion-failure] Type `Any | Class6Any` does not match asserted type `Any`'] +Line 166: Unexpected errors ['constructors_callable.py:166:1: error[type-assertion-failure] Type `Class7[int] | Class7[str]` does not match asserted type `Class7[int]`'] +Line 167: Unexpected errors ['constructors_callable.py:167:1: error[type-assertion-failure] Type `Class7[int] | Class7[str]` does not match asserted type `Class7[str]`'] +""" +output = """ +constructors_callable.py:36:13: info[revealed-type] Revealed type: `(x: int) -> Class1` +constructors_callable.py:38:1: error[missing-argument] No argument provided for required parameter `x` +constructors_callable.py:39:1: error[missing-argument] No argument provided for required parameter `x` +constructors_callable.py:39:4: error[unknown-argument] Argument `y` does not match any known parameter +constructors_callable.py:49:13: info[revealed-type] Revealed type: `() -> Class2` +constructors_callable.py:51:4: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 1 +constructors_callable.py:64:13: info[revealed-type] Revealed type: `(...) -> Class3` +constructors_callable.py:79:13: info[revealed-type] Revealed type: `(x: int) -> int` +constructors_callable.py:81:1: error[missing-argument] No argument provided for required parameter `x` +constructors_callable.py:82:1: error[missing-argument] No argument provided for required parameter `x` +constructors_callable.py:82:4: error[unknown-argument] Argument `y` does not match any known parameter +constructors_callable.py:99:13: info[revealed-type] Revealed type: `(...) -> Unknown` +constructors_callable.py:102:5: error[type-assertion-failure] Type `Unknown` does not match asserted type `Never` +constructors_callable.py:107:5: error[type-assertion-failure] Type `Unknown` does not match asserted type `Never` +constructors_callable.py:127:13: info[revealed-type] Revealed type: `() -> Class6Proxy` +constructors_callable.py:129:4: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 1 +constructors_callable.py:143:27: error[invalid-argument-type] Argument to function `accepts_callable` is incorrect: Expected `() -> Any | Class6Any`, found `` +constructors_callable.py:144:13: info[revealed-type] Revealed type: `() -> Any | Class6Any` +constructors_callable.py:145:1: error[type-assertion-failure] Type `Any | Class6Any` does not match asserted type `Any` +constructors_callable.py:146:8: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 1 +constructors_callable.py:164:5: info[revealed-type] Revealed type: `Overload[[T](x: int) -> Class7[int] | Class7[str], [T](x: str) -> Class7[int] | Class7[str]]` +constructors_callable.py:166:1: error[type-assertion-failure] Type `Class7[int] | Class7[str]` does not match asserted type `Class7[int]` +constructors_callable.py:167:1: error[type-assertion-failure] Type `Class7[int] | Class7[str]` does not match asserted type `Class7[str]` +constructors_callable.py:184:13: info[revealed-type] Revealed type: `[T](x: list[T], y: list[T]) -> Class8[T]` +constructors_callable.py:186:4: error[invalid-argument-type] Argument is incorrect: Expected `list[int | str]`, found `list[int]` +constructors_callable.py:186:9: error[invalid-argument-type] Argument is incorrect: Expected `list[int | str]`, found `list[str]` +constructors_callable.py:195:13: info[revealed-type] Revealed type: `[T](x: list[T], y: list[T]) -> Class9` +constructors_callable.py:197:4: error[invalid-argument-type] Argument is incorrect: Expected `list[int | str]`, found `list[int]` +constructors_callable.py:197:9: error[invalid-argument-type] Argument is incorrect: Expected `list[int | str]`, found `list[str]` +""" diff --git a/conformance/results/ty/constructors_consistency.toml b/conformance/results/ty/constructors_consistency.toml new file mode 100644 index 00000000..cdd4d0cd --- /dev/null +++ b/conformance/results/ty/constructors_consistency.toml @@ -0,0 +1,5 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +""" diff --git a/conformance/results/ty/dataclasses_descriptors.toml b/conformance/results/ty/dataclasses_descriptors.toml new file mode 100644 index 00000000..91ad20b9 --- /dev/null +++ b/conformance/results/ty/dataclasses_descriptors.toml @@ -0,0 +1,13 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Only infers a descriptor `__get__` method as being called when a descriptor attribute is accessed on an instance if the descriptor attribute is present in the class namespace. +""" +errors_diff = """ +Line 66: Unexpected errors ['dataclasses_descriptors.py:66:1: error[type-assertion-failure] Type `int | Desc2[int]` does not match asserted type `int`'] +Line 67: Unexpected errors ['dataclasses_descriptors.py:67:1: error[type-assertion-failure] Type `str | Desc2[str]` does not match asserted type `str`'] +""" +output = """ +dataclasses_descriptors.py:66:1: error[type-assertion-failure] Type `int | Desc2[int]` does not match asserted type `int` +dataclasses_descriptors.py:67:1: error[type-assertion-failure] Type `str | Desc2[str]` does not match asserted type `str` +""" diff --git a/conformance/results/ty/dataclasses_final.toml b/conformance/results/ty/dataclasses_final.toml new file mode 100644 index 00000000..cc9a5eb7 --- /dev/null +++ b/conformance/results/ty/dataclasses_final.toml @@ -0,0 +1,10 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +dataclasses_final.py:27:1: error[invalid-assignment] Cannot assign to final attribute `final_classvar` on type `` +dataclasses_final.py:35:1: error[invalid-assignment] Cannot assign to final attribute `final_no_default` on type `D` +dataclasses_final.py:36:1: error[invalid-assignment] Cannot assign to final attribute `final_with_default` on type `D` +dataclasses_final.py:37:1: error[invalid-assignment] Cannot assign to final attribute `final_no_default` on type `` +dataclasses_final.py:38:1: error[invalid-assignment] Cannot assign to final attribute `final_with_default` on type `` +""" diff --git a/conformance/results/ty/dataclasses_frozen.toml b/conformance/results/ty/dataclasses_frozen.toml new file mode 100644 index 00000000..41031640 --- /dev/null +++ b/conformance/results/ty/dataclasses_frozen.toml @@ -0,0 +1,9 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +dataclasses_frozen.py:16:1: error[invalid-assignment] Property `a` defined in `DC1` is read-only +dataclasses_frozen.py:17:1: error[invalid-assignment] Property `b` defined in `DC1` is read-only +dataclasses_frozen.py:23:7: error[invalid-frozen-dataclass-subclass] Non-frozen dataclass `DC2` cannot inherit from frozen dataclass `DC1` +dataclasses_frozen.py:33:7: error[invalid-frozen-dataclass-subclass] Frozen dataclass `DC4` cannot inherit from non-frozen dataclass `DC3` +""" diff --git a/conformance/results/ty/dataclasses_hash.toml b/conformance/results/ty/dataclasses_hash.toml new file mode 100644 index 00000000..8c24b29f --- /dev/null +++ b/conformance/results/ty/dataclasses_hash.toml @@ -0,0 +1,13 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Understands the `Hashable` protocol as equivalent to `object`. +""" +errors_diff = """ +Line 18: Expected 1 errors +Line 40: Expected 1 errors +""" +output = """ +dataclasses_hash.py:17:1: error[call-non-callable] Object of type `None` is not callable +dataclasses_hash.py:39:1: error[call-non-callable] Object of type `None` is not callable +""" diff --git a/conformance/results/ty/dataclasses_inheritance.toml b/conformance/results/ty/dataclasses_inheritance.toml new file mode 100644 index 00000000..d342acf7 --- /dev/null +++ b/conformance/results/ty/dataclasses_inheritance.toml @@ -0,0 +1,9 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +notes = """Currently only enforces the Liskov Substitution Principle for methods.""" +errors_diff = """ +Line 62: Expected 1 errors +Line 66: Expected 1 errors +""" +output = """ +""" diff --git a/conformance/results/ty/dataclasses_kwonly.toml b/conformance/results/ty/dataclasses_kwonly.toml new file mode 100644 index 00000000..902795f6 --- /dev/null +++ b/conformance/results/ty/dataclasses_kwonly.toml @@ -0,0 +1,8 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +dataclasses_kwonly.py:23:11: error[too-many-positional-arguments] Too many positional arguments: expected 1, got 2 +dataclasses_kwonly.py:38:11: error[too-many-positional-arguments] Too many positional arguments: expected 1, got 2 +dataclasses_kwonly.py:53:11: error[too-many-positional-arguments] Too many positional arguments: expected 1, got 2 +""" diff --git a/conformance/results/ty/dataclasses_match_args.toml b/conformance/results/ty/dataclasses_match_args.toml new file mode 100644 index 00000000..7c80a2e8 --- /dev/null +++ b/conformance/results/ty/dataclasses_match_args.toml @@ -0,0 +1,11 @@ +conformance_automated = "Fail" +conformant = "Pass" +notes = """ +Infers `__match_args__` as having type `tuple[()] | Unknown` for `__match_args__ = ()`""" +errors_diff = """ +Line 49: Unexpected errors ['dataclasses_match_args.py:49:1: error[type-assertion-failure] Type `Unknown | tuple[()]` does not match asserted type `tuple[()]`'] +""" +output = """ +dataclasses_match_args.py:42:1: error[unresolved-attribute] Class `DC4` has no attribute `__match_args__` +dataclasses_match_args.py:49:1: error[type-assertion-failure] Type `Unknown | tuple[()]` does not match asserted type `tuple[()]` +""" diff --git a/conformance/results/ty/dataclasses_order.toml b/conformance/results/ty/dataclasses_order.toml new file mode 100644 index 00000000..cd0a0cb4 --- /dev/null +++ b/conformance/results/ty/dataclasses_order.toml @@ -0,0 +1,6 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +dataclasses_order.py:50:4: error[unsupported-operator] Operator `<` is not supported between objects of type `DC1` and `DC2` +""" diff --git a/conformance/results/ty/dataclasses_postinit.toml b/conformance/results/ty/dataclasses_postinit.toml new file mode 100644 index 00000000..83f2f241 --- /dev/null +++ b/conformance/results/ty/dataclasses_postinit.toml @@ -0,0 +1,9 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +dataclasses_postinit.py:19:9: error[invalid-dataclass] Invalid `__post_init__` signature for dataclass `DC1` +dataclasses_postinit.py:28:7: error[unresolved-attribute] Object of type `DC1` has no attribute `x` +dataclasses_postinit.py:29:7: error[unresolved-attribute] Object of type `DC1` has no attribute `y` +dataclasses_postinit.py:36:9: error[invalid-dataclass] Invalid `__post_init__` signature for dataclass `DC2` +""" diff --git a/conformance/results/ty/dataclasses_slots.toml b/conformance/results/ty/dataclasses_slots.toml new file mode 100644 index 00000000..818e9cd4 --- /dev/null +++ b/conformance/results/ty/dataclasses_slots.toml @@ -0,0 +1,14 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Synthesizes a `__slots__` attribute but does not validate attribute assignments against `__slots__`. +""" +errors_diff = """ +Line 25: Expected 1 errors +Line 38: Expected 1 errors +Lines 10, 11: Expected error (tag 'DC1') +""" +output = """ +dataclasses_slots.py:66:1: error[unresolved-attribute] Class `DC6` has no attribute `__slots__` +dataclasses_slots.py:69:1: error[unresolved-attribute] Object of type `DC6` has no attribute `__slots__` +""" diff --git a/conformance/results/ty/dataclasses_transform_class.toml b/conformance/results/ty/dataclasses_transform_class.toml new file mode 100644 index 00000000..5756e69d --- /dev/null +++ b/conformance/results/ty/dataclasses_transform_class.toml @@ -0,0 +1,13 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +dataclasses_transform_class.py:51:7: error[invalid-frozen-dataclass-subclass] Non-frozen dataclass `Customer1Subclass` cannot inherit from frozen dataclass `Customer1` +dataclasses_transform_class.py:63:1: error[invalid-assignment] Property `id` defined in `Customer1` is read-only +dataclasses_transform_class.py:66:8: error[missing-argument] No arguments provided for required parameters `id`, `name` +dataclasses_transform_class.py:66:18: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 2 +dataclasses_transform_class.py:72:6: error[unsupported-operator] Operator `<` is not supported between two objects of type `Customer1` +dataclasses_transform_class.py:82:8: error[missing-argument] No argument provided for required parameter `id` +dataclasses_transform_class.py:82:18: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 2 +dataclasses_transform_class.py:122:1: error[invalid-assignment] Property `id` defined in `Customer3` is read-only +""" diff --git a/conformance/results/ty/dataclasses_transform_converter.toml b/conformance/results/ty/dataclasses_transform_converter.toml new file mode 100644 index 00000000..c9e0e839 --- /dev/null +++ b/conformance/results/ty/dataclasses_transform_converter.toml @@ -0,0 +1,48 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 118: Expected 1 errors +Line 104: Unexpected errors ['dataclasses_transform_converter.py:104:30: error[invalid-assignment] Object of type `dict[str, str] | dict[bytes, bytes]` is not assignable to `dict[str, str]`', "dataclasses_transform_converter.py:104:42: error[invalid-argument-type] Argument to function `model_field` is incorrect: Expected `(Iterable[list[str]] | Iterable[list[bytes]], /) -> dict[str, str] | dict[bytes, bytes]`, found ``"] +Line 112: Unexpected errors ['dataclasses_transform_converter.py:112:11: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f0"]`', 'dataclasses_transform_converter.py:112:17: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f1"]`', 'dataclasses_transform_converter.py:112:23: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f2"]`', 'dataclasses_transform_converter.py:112:29: error[invalid-argument-type] Argument is incorrect: Expected `ConverterClass`, found `Literal[b"f6"]`', 'dataclasses_transform_converter.py:112:36: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `list[Unknown]`'] +Line 114: Unexpected errors ['dataclasses_transform_converter.py:114:1: error[invalid-assignment] Object of type `Literal["f1"]` is not assignable to attribute `field0` of type `int`'] +Line 115: Unexpected errors ['dataclasses_transform_converter.py:115:1: error[invalid-assignment] Object of type `Literal["f6"]` is not assignable to attribute `field3` of type `ConverterClass`'] +Line 116: Unexpected errors ['dataclasses_transform_converter.py:116:1: error[invalid-assignment] Object of type `Literal[b"f6"]` is not assignable to attribute `field3` of type `ConverterClass`'] +Line 121: Unexpected errors ['dataclasses_transform_converter.py:121:11: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f0"]`', 'dataclasses_transform_converter.py:121:17: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f1"]`', 'dataclasses_transform_converter.py:121:23: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f2"]`', 'dataclasses_transform_converter.py:121:29: error[invalid-argument-type] Argument is incorrect: Expected `ConverterClass`, found `Literal["f6"]`', 'dataclasses_transform_converter.py:121:35: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["1"]`', 'dataclasses_transform_converter.py:121:40: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, str]`, found `tuple[tuple[Literal["a"], Literal["1"]], tuple[Literal["b"], Literal["2"]]]`'] +""" +output = """ +dataclasses_transform_converter.py:48:31: error[invalid-argument-type] Argument to function `model_field` is incorrect: Expected `(Unknown, /) -> Unknown`, found `def bad_converter1() -> int` +dataclasses_transform_converter.py:49:31: error[invalid-argument-type] Argument to function `model_field` is incorrect: Expected `(Unknown, /) -> Unknown`, found `def bad_converter2(*, x: int) -> int` +dataclasses_transform_converter.py:104:30: error[invalid-assignment] Object of type `dict[str, str] | dict[bytes, bytes]` is not assignable to `dict[str, str]` +dataclasses_transform_converter.py:104:42: error[invalid-argument-type] Argument to function `model_field` is incorrect: Expected `(Iterable[list[str]] | Iterable[list[bytes]], /) -> dict[str, str] | dict[bytes, bytes]`, found `` +dataclasses_transform_converter.py:107:8: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f1"]` +dataclasses_transform_converter.py:107:14: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f2"]` +dataclasses_transform_converter.py:107:20: error[invalid-argument-type] Argument is incorrect: Expected `ConverterClass`, found `Literal[b"f3"]` +dataclasses_transform_converter.py:107:27: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `list[Unknown]` +dataclasses_transform_converter.py:108:5: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f0"]` +dataclasses_transform_converter.py:108:11: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f1"]` +dataclasses_transform_converter.py:108:17: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f2"]` +dataclasses_transform_converter.py:108:23: error[invalid-argument-type] Argument is incorrect: Expected `ConverterClass`, found `Literal[1]` +dataclasses_transform_converter.py:108:26: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `list[Unknown]` +dataclasses_transform_converter.py:109:5: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f0"]` +dataclasses_transform_converter.py:109:11: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f1"]` +dataclasses_transform_converter.py:109:17: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f2"]` +dataclasses_transform_converter.py:109:23: error[invalid-argument-type] Argument is incorrect: Expected `ConverterClass`, found `Literal["f3"]` +dataclasses_transform_converter.py:109:29: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `complex` +dataclasses_transform_converter.py:112:11: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f0"]` +dataclasses_transform_converter.py:112:17: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f1"]` +dataclasses_transform_converter.py:112:23: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f2"]` +dataclasses_transform_converter.py:112:29: error[invalid-argument-type] Argument is incorrect: Expected `ConverterClass`, found `Literal[b"f6"]` +dataclasses_transform_converter.py:112:36: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `list[Unknown]` +dataclasses_transform_converter.py:114:1: error[invalid-assignment] Object of type `Literal["f1"]` is not assignable to attribute `field0` of type `int` +dataclasses_transform_converter.py:115:1: error[invalid-assignment] Object of type `Literal["f6"]` is not assignable to attribute `field3` of type `ConverterClass` +dataclasses_transform_converter.py:116:1: error[invalid-assignment] Object of type `Literal[b"f6"]` is not assignable to attribute `field3` of type `ConverterClass` +dataclasses_transform_converter.py:119:1: error[invalid-assignment] Object of type `Literal[1]` is not assignable to attribute `field3` of type `ConverterClass` +dataclasses_transform_converter.py:121:11: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f0"]` +dataclasses_transform_converter.py:121:17: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f1"]` +dataclasses_transform_converter.py:121:23: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["f2"]` +dataclasses_transform_converter.py:121:29: error[invalid-argument-type] Argument is incorrect: Expected `ConverterClass`, found `Literal["f6"]` +dataclasses_transform_converter.py:121:35: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["1"]` +dataclasses_transform_converter.py:121:40: error[invalid-argument-type] Argument is incorrect: Expected `dict[str, str]`, found `tuple[tuple[Literal["a"], Literal["1"]], tuple[Literal["b"], Literal["2"]]]` +dataclasses_transform_converter.py:130:31: error[invalid-argument-type] Argument to function `model_field` is incorrect: Expected `(str | Literal[1], /) -> int`, found `def converter_simple(s: str) -> int` +dataclasses_transform_converter.py:133:31: error[invalid-argument-type] Argument to function `model_field` is incorrect: Expected `(str | int, /) -> int`, found `def converter_simple(s: str) -> int` +""" diff --git a/conformance/results/ty/dataclasses_transform_field.toml b/conformance/results/ty/dataclasses_transform_field.toml new file mode 100644 index 00000000..62ef6279 --- /dev/null +++ b/conformance/results/ty/dataclasses_transform_field.toml @@ -0,0 +1,8 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +dataclasses_transform_field.py:64:16: error[unknown-argument] Argument `id` does not match any known parameter +dataclasses_transform_field.py:75:1: error[missing-argument] No argument provided for required parameter `name` +dataclasses_transform_field.py:75:16: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 1 +""" diff --git a/conformance/results/ty/dataclasses_transform_func.toml b/conformance/results/ty/dataclasses_transform_func.toml new file mode 100644 index 00000000..2355c338 --- /dev/null +++ b/conformance/results/ty/dataclasses_transform_func.toml @@ -0,0 +1,12 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +dataclasses_transform_func.py:56:1: error[invalid-assignment] Object of type `Literal[3]` is not assignable to attribute `name` of type `str` +dataclasses_transform_func.py:60:6: error[unsupported-operator] Operator `<` is not supported between two objects of type `Customer1` +dataclasses_transform_func.py:64:36: error[unknown-argument] Argument `salary` does not match any known parameter +dataclasses_transform_func.py:70:8: error[missing-argument] No arguments provided for required parameters `id`, `name` +dataclasses_transform_func.py:70:18: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 2 +dataclasses_transform_func.py:89:7: error[invalid-frozen-dataclass-subclass] Non-frozen dataclass `Customer3Subclass` cannot inherit from frozen dataclass `Customer3` +dataclasses_transform_func.py:96:1: error[invalid-assignment] Property `id` defined in `Customer3` is read-only +""" diff --git a/conformance/results/ty/dataclasses_transform_meta.toml b/conformance/results/ty/dataclasses_transform_meta.toml new file mode 100644 index 00000000..a2c5e502 --- /dev/null +++ b/conformance/results/ty/dataclasses_transform_meta.toml @@ -0,0 +1,13 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +dataclasses_transform_meta.py:51:7: error[invalid-frozen-dataclass-subclass] Non-frozen dataclass `Customer1Subclass` cannot inherit from frozen dataclass `Customer1` +dataclasses_transform_meta.py:63:1: error[invalid-assignment] Property `id` defined in `Customer1` is read-only +dataclasses_transform_meta.py:66:8: error[missing-argument] No arguments provided for required parameters `id`, `name` +dataclasses_transform_meta.py:66:18: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 2 +dataclasses_transform_meta.py:73:6: error[unsupported-operator] Operator `<` is not supported between two objects of type `Customer1` +dataclasses_transform_meta.py:83:8: error[missing-argument] No argument provided for required parameter `id` +dataclasses_transform_meta.py:83:18: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 2 +dataclasses_transform_meta.py:103:1: error[invalid-assignment] Property `id` defined in `Customer3` is read-only +""" diff --git a/conformance/results/ty/dataclasses_usage.toml b/conformance/results/ty/dataclasses_usage.toml new file mode 100644 index 00000000..60aa8501 --- /dev/null +++ b/conformance/results/ty/dataclasses_usage.toml @@ -0,0 +1,16 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +dataclasses_usage.py:50:6: error[missing-argument] No argument provided for required parameter `unit_price` +dataclasses_usage.py:51:28: error[invalid-argument-type] Argument is incorrect: Expected `int | float`, found `Literal["price"]` +dataclasses_usage.py:52:36: error[too-many-positional-arguments] Too many positional arguments: expected 3, got 4 +dataclasses_usage.py:61:5: error[dataclass-field-order] Required field `b` cannot be defined after fields with default values +dataclasses_usage.py:67:5: error[dataclass-field-order] Required field `b` cannot be defined after fields with default values +dataclasses_usage.py:73:5: error[dataclass-field-order] Required field `b` cannot be defined after fields with default values +dataclasses_usage.py:83:13: error[too-many-positional-arguments] Too many positional arguments: expected 1, got 2 +dataclasses_usage.py:88:14: error[invalid-assignment] Object of type `dataclasses.Field[str]` is not assignable to `int` +dataclasses_usage.py:127:8: error[too-many-positional-arguments] Too many positional arguments: expected 1, got 2 +dataclasses_usage.py:130:1: error[missing-argument] No argument provided for required parameter `y` of bound method `__init__` +dataclasses_usage.py:179:6: error[too-many-positional-arguments] Too many positional arguments to bound method `__init__`: expected 1, got 2 +""" diff --git a/conformance/results/ty/directives_assert_type.toml b/conformance/results/ty/directives_assert_type.toml new file mode 100644 index 00000000..75907e11 --- /dev/null +++ b/conformance/results/ty/directives_assert_type.toml @@ -0,0 +1,12 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +directives_assert_type.py:27:5: error[type-assertion-failure] Type `int | str` does not match asserted type `int` +directives_assert_type.py:28:5: error[type-assertion-failure] Type `int | str` does not match asserted type `Any` +directives_assert_type.py:29:5: error[type-assertion-failure] Type `Any` does not match asserted type `int` +directives_assert_type.py:30:5: error[type-assertion-failure] Type `Literal[4]` does not match asserted type `int` +directives_assert_type.py:32:5: error[missing-argument] No arguments provided for required parameters `value`, `type` of function `assert_type` +directives_assert_type.py:33:5: error[type-assertion-failure] Type `Literal[""]` does not match asserted type `int` +directives_assert_type.py:34:31: error[too-many-positional-arguments] Too many positional arguments to function `assert_type`: expected 2, got 3 +""" diff --git a/conformance/results/ty/directives_cast.toml b/conformance/results/ty/directives_cast.toml new file mode 100644 index 00000000..98dabb13 --- /dev/null +++ b/conformance/results/ty/directives_cast.toml @@ -0,0 +1,8 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +directives_cast.py:15:8: error[missing-argument] No arguments provided for required parameters `typ`, `val` of function `cast` +directives_cast.py:16:13: error[invalid-type-form] Int literals are not allowed in this context in a type expression +directives_cast.py:17:22: error[too-many-positional-arguments] Too many positional arguments to function `cast`: expected 2, got 3 +""" diff --git a/conformance/results/ty/directives_deprecated.toml b/conformance/results/ty/directives_deprecated.toml new file mode 100644 index 00000000..45177b36 --- /dev/null +++ b/conformance/results/ty/directives_deprecated.toml @@ -0,0 +1,24 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not detect calls to deprecated overloads. +Does not detect implicit calls to deprecated dunder methods, for example via operators. +Does not detect accesses of, or attempts to set, deprecated properties. +""" +errors_diff = """ +Line 30: Expected 1 errors +Line 41: Expected 1 errors +Line 42: Expected 1 errors +Line 44: Expected 1 errors +Line 47: Expected 1 errors +Line 48: Expected 1 errors +Line 58: Expected 1 errors +""" +output = """ +directives_deprecated.py:18:44: error[deprecated] The class `Ham` is deprecated: Use Spam instead +directives_deprecated.py:24:9: error[deprecated] The function `norwegian_blue` is deprecated: It is pining for the fjords +directives_deprecated.py:25:13: error[deprecated] The function `norwegian_blue` is deprecated: It is pining for the fjords +directives_deprecated.py:34:7: error[deprecated] The class `Ham` is deprecated: Use Spam instead +directives_deprecated.py:69:1: error[deprecated] The function `lorem` is deprecated: Deprecated +directives_deprecated.py:98:7: error[deprecated] The function `foo` is deprecated: Deprecated +""" diff --git a/conformance/results/ty/directives_no_type_check.toml b/conformance/results/ty/directives_no_type_check.toml new file mode 100644 index 00000000..bbaa658b --- /dev/null +++ b/conformance/results/ty/directives_no_type_check.toml @@ -0,0 +1,9 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +directives_no_type_check.py:15:14: error[invalid-assignment] Object of type `Literal[""]` is not assignable to `int` +directives_no_type_check.py:29:7: error[invalid-argument-type] Argument to function `func1` is incorrect: Expected `int`, found `Literal[b"invalid"]` +directives_no_type_check.py:29:19: error[invalid-argument-type] Argument to function `func1` is incorrect: Expected `str`, found `Literal[b"arguments"]` +directives_no_type_check.py:32:1: error[missing-argument] No arguments provided for required parameters `a`, `b` of function `func1` +""" diff --git a/conformance/results/ty/directives_reveal_type.toml b/conformance/results/ty/directives_reveal_type.toml new file mode 100644 index 00000000..aa525cb4 --- /dev/null +++ b/conformance/results/ty/directives_reveal_type.toml @@ -0,0 +1,11 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +directives_reveal_type.py:14:17: info[revealed-type] Revealed type: `int | str` +directives_reveal_type.py:15:17: info[revealed-type] Revealed type: `list[int]` +directives_reveal_type.py:16:17: info[revealed-type] Revealed type: `Any` +directives_reveal_type.py:17:17: info[revealed-type] Revealed type: `ForwardReference` +directives_reveal_type.py:19:5: error[missing-argument] No argument provided for required parameter `obj` of function `reveal_type` +directives_reveal_type.py:20:20: error[too-many-positional-arguments] Too many positional arguments to function `reveal_type`: expected 1, got 2 +""" diff --git a/conformance/results/ty/directives_type_checking.toml b/conformance/results/ty/directives_type_checking.toml new file mode 100644 index 00000000..a9ad6809 --- /dev/null +++ b/conformance/results/ty/directives_type_checking.toml @@ -0,0 +1,11 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Attempts to detect some errors even in blocks it determines to be unreachable, including in `if not TYPE_CHECKING` blocks. +""" +errors_diff = """ +Line 11: Unexpected errors ['directives_type_checking.py:11:14: error[invalid-assignment] Object of type `Literal[""]` is not assignable to `int`'] +""" +output = """ +directives_type_checking.py:11:14: error[invalid-assignment] Object of type `Literal[""]` is not assignable to `int` +""" diff --git a/conformance/results/ty/directives_type_ignore.toml b/conformance/results/ty/directives_type_ignore.toml new file mode 100644 index 00000000..cdd4d0cd --- /dev/null +++ b/conformance/results/ty/directives_type_ignore.toml @@ -0,0 +1,5 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +""" diff --git a/conformance/results/ty/directives_type_ignore_file1.toml b/conformance/results/ty/directives_type_ignore_file1.toml new file mode 100644 index 00000000..4c7c7e85 --- /dev/null +++ b/conformance/results/ty/directives_type_ignore_file1.toml @@ -0,0 +1,7 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +directives_type_ignore_file1.py:11:7: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive +directives_type_ignore_file1.py:14:17: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive +""" diff --git a/conformance/results/ty/directives_type_ignore_file2.toml b/conformance/results/ty/directives_type_ignore_file2.toml new file mode 100644 index 00000000..76fb1fde --- /dev/null +++ b/conformance/results/ty/directives_type_ignore_file2.toml @@ -0,0 +1,9 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +directives_type_ignore_file2.py:7:1: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive +directives_type_ignore_file2.py:9:7: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive +directives_type_ignore_file2.py:12:17: warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive +directives_type_ignore_file2.py:14:10: error[invalid-assignment] Object of type `Literal[""]` is not assignable to `int` +""" diff --git a/conformance/results/ty/directives_version_platform.toml b/conformance/results/ty/directives_version_platform.toml new file mode 100644 index 00000000..c74b9039 --- /dev/null +++ b/conformance/results/ty/directives_version_platform.toml @@ -0,0 +1,10 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +directives_version_platform.py:33:19: error[unresolved-reference] Name `val3` used when not defined +directives_version_platform.py:50:19: error[unresolved-reference] Name `val6` used when not defined +directives_version_platform.py:59:19: error[unresolved-reference] Name `val9` used when not defined +directives_version_platform.py:66:19: error[unresolved-reference] Name `val10` used when not defined +directives_version_platform.py:75:19: error[unresolved-reference] Name `val13` used when not defined +""" diff --git a/conformance/results/ty/enums_behaviors.toml b/conformance/results/ty/enums_behaviors.toml new file mode 100644 index 00000000..2a9f002b --- /dev/null +++ b/conformance/results/ty/enums_behaviors.toml @@ -0,0 +1,8 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +enums_behaviors.py:28:1: error[type-assertion-failure] Type `Color` does not match asserted type `Literal[Color.RED]` +enums_behaviors.py:32:1: error[type-assertion-failure] Type `Color` does not match asserted type `Literal[Color.BLUE]` +enums_behaviors.py:44:21: error[subclass-of-final-class] Class `ExtendedShape` cannot inherit from final class `Shape` +""" diff --git a/conformance/results/ty/enums_definition.toml b/conformance/results/ty/enums_definition.toml new file mode 100644 index 00000000..cdd4d0cd --- /dev/null +++ b/conformance/results/ty/enums_definition.toml @@ -0,0 +1,5 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +""" diff --git a/conformance/results/ty/enums_expansion.toml b/conformance/results/ty/enums_expansion.toml new file mode 100644 index 00000000..5e5e1f0d --- /dev/null +++ b/conformance/results/ty/enums_expansion.toml @@ -0,0 +1,10 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """Does not support `enum.Flag`.""" +errors_diff = """ +Line 53: Expected 1 errors +Line 52: Unexpected errors ['enums_expansion.py:52:9: error[type-assertion-failure] Type `Literal[CustomFlags.FLAG3]` does not match asserted type `CustomFlags`'] +""" +output = """ +enums_expansion.py:52:9: error[type-assertion-failure] Type `Literal[CustomFlags.FLAG3]` does not match asserted type `CustomFlags` +""" diff --git a/conformance/results/ty/enums_member_names.toml b/conformance/results/ty/enums_member_names.toml new file mode 100644 index 00000000..cdd4d0cd --- /dev/null +++ b/conformance/results/ty/enums_member_names.toml @@ -0,0 +1,5 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +""" diff --git a/conformance/results/ty/enums_member_values.toml b/conformance/results/ty/enums_member_values.toml new file mode 100644 index 00000000..2686347f --- /dev/null +++ b/conformance/results/ty/enums_member_values.toml @@ -0,0 +1,10 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +enums_member_values.py:50:5: error[invalid-assignment] Enum member `MARS` is incompatible with `__init__` +enums_member_values.py:51:5: error[invalid-assignment] Enum member `JUPITER` is incompatible with `__init__` +enums_member_values.py:54:1: error[type-assertion-failure] Type `Any` does not match asserted type `Literal[1]` +enums_member_values.py:78:5: error[invalid-assignment] Enum member `GREEN` value is not assignable to expected type +enums_member_values.py:85:9: error[invalid-assignment] Object of type `int` is not assignable to attribute `_value_` of type `str` +""" diff --git a/conformance/results/ty/enums_members.toml b/conformance/results/ty/enums_members.toml new file mode 100644 index 00000000..ea7380da --- /dev/null +++ b/conformance/results/ty/enums_members.toml @@ -0,0 +1,17 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +enums_members.py:50:10: error[invalid-enum-member-annotation] Type annotation on enum member `DOG` is not allowed +enums_members.py:82:20: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +enums_members.py:83:20: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +enums_members.py:84:18: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +enums_members.py:85:16: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +enums_members.py:116:1: error[type-assertion-failure] Type `int` does not match asserted type `Unknown` +enums_members.py:116:32: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +enums_members.py:128:21: info[revealed-type] Revealed type: `Unknown | Literal[2]` +enums_members.py:129:9: error[type-assertion-failure] Type `Unknown | Literal[2]` does not match asserted type `Unknown` +enums_members.py:129:43: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +enums_members.py:146:1: error[type-assertion-failure] Type `Unknown | Literal[2]` does not match asserted type `int` +enums_members.py:147:1: error[type-assertion-failure] Type `Unknown | Literal[3]` does not match asserted type `int` +""" diff --git a/conformance/results/ty/exceptions_context_managers.toml b/conformance/results/ty/exceptions_context_managers.toml new file mode 100644 index 00000000..8ba80064 --- /dev/null +++ b/conformance/results/ty/exceptions_context_managers.toml @@ -0,0 +1,10 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 50: Unexpected errors ['exceptions_context_managers.py:50:5: error[type-assertion-failure] Type `str` does not match asserted type `int | str`'] +Line 57: Unexpected errors ['exceptions_context_managers.py:57:5: error[type-assertion-failure] Type `str` does not match asserted type `int | str`'] +""" +output = """ +exceptions_context_managers.py:50:5: error[type-assertion-failure] Type `str` does not match asserted type `int | str` +exceptions_context_managers.py:57:5: error[type-assertion-failure] Type `str` does not match asserted type `int | str` +""" diff --git a/conformance/results/ty/generics_base_class.toml b/conformance/results/ty/generics_base_class.toml new file mode 100644 index 00000000..d3da0652 --- /dev/null +++ b/conformance/results/ty/generics_base_class.toml @@ -0,0 +1,12 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +generics_base_class.py:26:26: error[invalid-argument-type] Argument to function `takes_dict_incorrect` is incorrect: Expected `dict[str, list[object]]`, found `SymbolTable` +generics_base_class.py:29:14: error[invalid-type-form] `typing.Generic` is not allowed in type expressions +generics_base_class.py:30:8: error[invalid-type-form] `typing.Generic` is not allowed in type expressions +generics_base_class.py:49:38: error[invalid-type-arguments] Too many type arguments to class `LinkedList`: expected 1, got 2 +generics_base_class.py:61:30: error[invalid-type-arguments] Too many type arguments to class `MyDict`: expected 1, got 2 +generics_base_class.py:68:17: error[invalid-generic-class] Type parameter `T` cannot appear multiple times in `Generic` subscription +generics_base_class.py:98:7: error[invalid-generic-class] Inconsistent type arguments: class cannot inherit from both `Grandparent[T2@BadChild, T1@BadChild]` and `Grandparent[T1@BadChild, T2@BadChild]` +""" diff --git a/conformance/results/ty/generics_basic.toml b/conformance/results/ty/generics_basic.toml new file mode 100644 index 00000000..cfeb943c --- /dev/null +++ b/conformance/results/ty/generics_basic.toml @@ -0,0 +1,22 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Incorrectly allows constrained type variables to be solved to a union of their constraints. +""" +errors_diff = """ +Line 40: Expected 1 errors +Line 41: Expected 1 errors +Line 69: Expected 1 errors +""" +output = """ +generics_basic.py:49:44: error[invalid-legacy-type-variable] A `TypeVar` cannot have exactly one constraint +generics_basic.py:55:53: error[invalid-type-variable-constraints] TypeVar constraint cannot be generic +generics_basic.py:121:13: error[invalid-generic-class] Type parameter `T` cannot appear multiple times in `Generic` subscription +generics_basic.py:157:5: error[invalid-argument-type] Method `__getitem__` of type `bound method MyMap1[str, int].__getitem__(key: str, /) -> int` cannot be called with key of type `Literal[0]` on object of type `MyMap1[str, int]` +generics_basic.py:158:5: error[invalid-argument-type] Method `__getitem__` of type `bound method MyMap2[int, str].__getitem__(key: str, /) -> int` cannot be called with key of type `Literal[0]` on object of type `MyMap2[int, str]` +generics_basic.py:162:12: error[invalid-argument-type] `` is not a valid argument to `Generic` +generics_basic.py:163:12: error[invalid-argument-type] `` is not a valid argument to `Protocol` +generics_basic.py:171:1: error[invalid-generic-class] `Generic` base class must include all type variables used in other base classes +generics_basic.py:172:1: error[invalid-generic-class] `Generic` base class must include all type variables used in other base classes +generics_basic.py:208:1: error[invalid-metaclass] Generic metaclasses are not supported +""" diff --git a/conformance/results/ty/generics_defaults.toml b/conformance/results/ty/generics_defaults.toml new file mode 100644 index 00000000..8fae90d2 --- /dev/null +++ b/conformance/results/ty/generics_defaults.toml @@ -0,0 +1,35 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not forbid a `TypeVar` immediately following a `TypeVarTuple` in a parameter list from having a default. +Does not support `TypeVarTuple`. +Does not fully support defaults for `ParamSpec`s. +""" +errors_diff = """ +Line 188: Expected 1 errors +Line 122: Unexpected errors ['generics_defaults.py:122:5: error[type-assertion-failure] Type `(**DefaultP@Class_ParamSpec) -> None` does not match asserted type `(str, int, /) -> None`'] +Line 139: Unexpected errors ['generics_defaults.py:139:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[str, int]`'] +Line 140: Unexpected errors ['generics_defaults.py:140:5: error[type-assertion-failure] Type `Class_TypeVarTuple` does not match asserted type `@Todo`'] +Line 200: Unexpected errors ['generics_defaults.py:200:17: error[invalid-type-form] The first argument to `Callable` must be either a list of types, ParamSpec, Concatenate, or `...`'] +Line 203: Unexpected errors ['generics_defaults.py:203:52: error[invalid-type-form] List literals are not allowed in this context in a type expression: Did you mean `list[bytes]`?'] +Line 204: Unexpected errors ['generics_defaults.py:204:5: error[type-assertion-failure] Type `@Todo` does not match asserted type `tuple[int, str]`'] +Line 205: Unexpected errors ['generics_defaults.py:205:5: error[type-assertion-failure] Type `@Todo` does not match asserted type `(int | float, bool, /) -> None`'] +Line 207: Unexpected errors ['generics_defaults.py:207:5: error[type-assertion-failure] Type `@Todo` does not match asserted type `tuple[int, str]`'] +Line 208: Unexpected errors ['generics_defaults.py:208:5: error[type-assertion-failure] Type `@Todo` does not match asserted type `(bytes, /) -> None`'] +""" +output = """ +generics_defaults.py:24:40: error[invalid-generic-class] Type parameter `T` without a default cannot follow earlier parameter `DefaultStrT` with a default +generics_defaults.py:66:8: error[invalid-type-arguments] No type argument provided for required type variable `T2` of class `AllTheDefaults` +generics_defaults.py:122:5: error[type-assertion-failure] Type `(**DefaultP@Class_ParamSpec) -> None` does not match asserted type `(str, int, /) -> None` +generics_defaults.py:139:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[str, int]` +generics_defaults.py:140:5: error[type-assertion-failure] Type `Class_TypeVarTuple` does not match asserted type `@Todo` +generics_defaults.py:152:51: error[invalid-type-variable-default] TypeVar default is not assignable to the TypeVar's upper bound +generics_defaults.py:159:52: error[invalid-type-variable-default] TypeVar default is inconsistent with the TypeVar's constraints: `int` is not one of the constraints of `Invalid2` +generics_defaults.py:177:1: error[type-assertion-failure] Type `int` does not match asserted type `Any` +generics_defaults.py:200:17: error[invalid-type-form] The first argument to `Callable` must be either a list of types, ParamSpec, Concatenate, or `...` +generics_defaults.py:203:52: error[invalid-type-form] List literals are not allowed in this context in a type expression: Did you mean `list[bytes]`? +generics_defaults.py:204:5: error[type-assertion-failure] Type `@Todo` does not match asserted type `tuple[int, str]` +generics_defaults.py:205:5: error[type-assertion-failure] Type `@Todo` does not match asserted type `(int | float, bool, /) -> None` +generics_defaults.py:207:5: error[type-assertion-failure] Type `@Todo` does not match asserted type `tuple[int, str]` +generics_defaults.py:208:5: error[type-assertion-failure] Type `@Todo` does not match asserted type `(bytes, /) -> None` +""" diff --git a/conformance/results/ty/generics_defaults_referential.toml b/conformance/results/ty/generics_defaults_referential.toml new file mode 100644 index 00000000..c2ad31d1 --- /dev/null +++ b/conformance/results/ty/generics_defaults_referential.toml @@ -0,0 +1,12 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +generics_defaults_referential.py:36:13: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int`, found `Literal[""]` +generics_defaults_referential.py:37:10: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int`, found `Literal[""]` +generics_defaults_referential.py:53:7: error[invalid-generic-class] Default of `Start2T` cannot reference out-of-scope type variable `StopT` +generics_defaults_referential.py:60:11: error[invalid-generic-class] Default of `S2` cannot reference out-of-scope type variable `S1` +generics_defaults_referential.py:68:40: error[invalid-type-variable-default] Default `X1` of TypeVar `Invalid1` is not assignable to upper bound `str` of `Invalid1` because its upper bound `int` is not assignable to `str` +generics_defaults_referential.py:74:52: error[invalid-type-variable-default] TypeVar default is inconsistent with the TypeVar's constraints: Bounded TypeVar cannot be used as the default for a constrained TypeVar +generics_defaults_referential.py:78:63: error[invalid-type-variable-default] Default `Y2` of TypeVar `AlsoInvalid2` is inconsistent with its constraints `AlsoInvalid2` because constraint `int` of `Y2` is not one of the constraints of `AlsoInvalid2` +""" diff --git a/conformance/results/ty/generics_defaults_specialization.toml b/conformance/results/ty/generics_defaults_specialization.toml new file mode 100644 index 00000000..3f874825 --- /dev/null +++ b/conformance/results/ty/generics_defaults_specialization.toml @@ -0,0 +1,11 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not reject subscription of an already-specialized generic class. +""" +errors_diff = """ +Line 55: Expected 1 errors +""" +output = """ +generics_defaults_specialization.py:30:15: error[invalid-type-arguments] Too many type arguments: expected between 0 and 1, got 2 +""" diff --git a/conformance/results/ty/generics_paramspec_basic.toml b/conformance/results/ty/generics_paramspec_basic.toml new file mode 100644 index 00000000..e9b05cfe --- /dev/null +++ b/conformance/results/ty/generics_paramspec_basic.toml @@ -0,0 +1,19 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not reject using a bare `ParamSpec` as a type alias value. +Does not support `Concatenate`. +""" +errors_diff = """ +Line 15: Expected 1 errors +Line 27: Expected 1 errors +""" +output = """ +generics_paramspec_basic.py:10:1: error[invalid-paramspec] The name of a `ParamSpec` (`NotIt`) must match the name of the variable it is assigned to (`WrongName`) +generics_paramspec_basic.py:23:14: error[invalid-type-form] Bare ParamSpec `P` is not valid in this context in a type expression +generics_paramspec_basic.py:23:20: error[invalid-type-form] Bare ParamSpec `P` is not valid in this context in a type expression +generics_paramspec_basic.py:31:19: error[invalid-type-arguments] ParamSpec `P` cannot be used to specialize type variable `_T` +generics_paramspec_basic.py:35:35: error[invalid-type-form] Bare ParamSpec `P` is not valid in this context in a type expression +generics_paramspec_basic.py:39:18: error[invalid-type-form] Bare ParamSpec `P` is not valid in this context in a type expression +generics_paramspec_basic.py:39:31: error[invalid-type-form] Bare ParamSpec `P` is not valid in this context in a type expression +""" diff --git a/conformance/results/ty/generics_paramspec_components.toml b/conformance/results/ty/generics_paramspec_components.toml new file mode 100644 index 00000000..fedff333 --- /dev/null +++ b/conformance/results/ty/generics_paramspec_components.toml @@ -0,0 +1,31 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Incorrectly allows using `*args: P.args` and `**kwargs: P.kwargs` when `P` has not been put into scope by any other parameter annotation or enclosing scope. +Does not support `Concatenate`. +""" +errors_diff = """ +Line 30: Expected 1 errors +Line 70: Expected 1 errors +Line 72: Expected 1 errors +""" +output = """ +generics_paramspec_components.py:17:25: error[invalid-type-form] `P.kwargs` is valid only in `**kwargs` annotation: Did you mean `P.args`? +generics_paramspec_components.py:17:45: error[invalid-type-form] `P.args` is valid only in `*args` annotation: Did you mean `P.kwargs`? +generics_paramspec_components.py:20:23: error[invalid-paramspec] `P.args` is only valid for annotating `*args` +generics_paramspec_components.py:23:46: error[invalid-paramspec] `*args: P.args` must be accompanied by `**kwargs: P.kwargs` +generics_paramspec_components.py:23:46: error[invalid-type-form] `P.args` is valid only in `*args` annotation: Did you mean `P.kwargs`? +generics_paramspec_components.py:26:46: error[invalid-paramspec] `*args: P.args` must be accompanied by `**kwargs: P.kwargs` +generics_paramspec_components.py:35:18: error[invalid-paramspec] `P.args` is only valid for annotating `*args` function parameters +generics_paramspec_components.py:36:20: error[invalid-paramspec] `P.kwargs` is only valid for annotating `**kwargs` function parameters +generics_paramspec_components.py:38:26: error[invalid-paramspec] `*args: P.args` must be accompanied by `**kwargs: P.kwargs` +generics_paramspec_components.py:41:31: error[invalid-paramspec] `**kwargs: P.kwargs` must be accompanied by `*args: P.args` +generics_paramspec_components.py:49:11: error[invalid-argument-type] Argument is incorrect: Expected `P@decorator.args`, found `P@decorator.kwargs` +generics_paramspec_components.py:49:20: error[invalid-argument-type] Argument is incorrect: Expected `P@decorator.kwargs`, found `P@decorator.args` +generics_paramspec_components.py:51:11: error[invalid-argument-type] Argument is incorrect: Expected `P@decorator.args`, found `Literal[1]` +generics_paramspec_components.py:60:28: error[invalid-paramspec] No parameters may appear between `*args: P.args` and `**kwargs: P.kwargs` +generics_paramspec_components.py:83:18: error[invalid-argument-type] Argument to function `foo` is incorrect: Expected `int`, found `(...)` +generics_paramspec_components.py:83:18: error[parameter-already-assigned] Multiple values provided for parameter 1 (`x`) of function `foo` +generics_paramspec_components.py:98:20: error[invalid-argument-type] Argument to function `twice` is incorrect: Expected `int`, found `Literal["A"]` +generics_paramspec_components.py:98:25: error[invalid-argument-type] Argument to function `twice` is incorrect: Expected `str`, found `Literal[1]` +""" diff --git a/conformance/results/ty/generics_paramspec_semantics.toml b/conformance/results/ty/generics_paramspec_semantics.toml new file mode 100644 index 00000000..b8806e5b --- /dev/null +++ b/conformance/results/ty/generics_paramspec_semantics.toml @@ -0,0 +1,24 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not support `Concatenate`. +""" +errors_diff = """ +Line 98: Expected 1 errors +Line 120: Expected 1 errors +Line 127: Expected 1 errors +Line 132: Expected 1 errors +Line 137: Expected 1 errors +Line 106: Unexpected errors ['generics_paramspec_semantics.py:106:13: error[missing-argument] No argument provided for required parameter `**kwargs`'] +Line 107: Unexpected errors ['generics_paramspec_semantics.py:107:13: error[missing-argument] No arguments provided for required parameters `*args`, `**kwargs`'] +""" +output = """ +generics_paramspec_semantics.py:26:4: error[positional-only-parameter-as-kwarg] Positional-only parameter 1 (`a`) passed as keyword argument +generics_paramspec_semantics.py:26:11: error[positional-only-parameter-as-kwarg] Positional-only parameter 2 (`b`) passed as keyword argument +generics_paramspec_semantics.py:27:9: error[invalid-argument-type] Argument is incorrect: Expected `bool`, found `Literal["A"]` +generics_paramspec_semantics.py:46:17: error[invalid-argument-type] Argument to function `func1` is incorrect: Expected `(x: int, y: str) -> int`, found `def y_x(y: int, x: str) -> int` +generics_paramspec_semantics.py:61:23: error[invalid-argument-type] Argument to function `func1` is incorrect: Expected `(*, x: int) -> int`, found `def keyword_only_y(*, y: int) -> int` +generics_paramspec_semantics.py:106:13: error[missing-argument] No argument provided for required parameter `**kwargs` +generics_paramspec_semantics.py:107:13: error[missing-argument] No arguments provided for required parameters `*args`, `**kwargs` +generics_paramspec_semantics.py:108:1: error[missing-argument] No argument provided for required parameter `**kwargs` +""" diff --git a/conformance/results/ty/generics_paramspec_specialization.toml b/conformance/results/ty/generics_paramspec_specialization.toml new file mode 100644 index 00000000..b9550203 --- /dev/null +++ b/conformance/results/ty/generics_paramspec_specialization.toml @@ -0,0 +1,10 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +generics_paramspec_specialization.py:44:27: error[invalid-type-arguments] Type argument for `ParamSpec` must be either a list of types, `ParamSpec`, `Concatenate`, or `...` +generics_paramspec_specialization.py:54:9: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal[""]` +generics_paramspec_specialization.py:55:16: error[invalid-argument-type] Argument is incorrect: Expected `bool`, found `Literal[""]` +generics_paramspec_specialization.py:60:9: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal[""]` +generics_paramspec_specialization.py:61:16: error[invalid-argument-type] Argument is incorrect: Expected `bool`, found `Literal[""]` +""" diff --git a/conformance/results/ty/generics_scoping.toml b/conformance/results/ty/generics_scoping.toml new file mode 100644 index 00000000..c8989dcb --- /dev/null +++ b/conformance/results/ty/generics_scoping.toml @@ -0,0 +1,25 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not reject `list[T]()` in the global scope, where `T` is an unbound type variable. +Does nto reject `alias: TypeAlias = list[T]` in the body scope of a class generic over a type variable `T`. +""" +errors_diff = """ +Line 98: Expected 1 errors +Line 107: Expected 1 errors +""" +output = """ +generics_scoping.py:15:1: error[type-assertion-failure] Type `Literal[1]` does not match asserted type `int` +generics_scoping.py:19:1: error[type-assertion-failure] Type `Literal["a"]` does not match asserted type `str` +generics_scoping.py:34:10: error[invalid-argument-type] Argument to bound method `meth_2` is incorrect: Expected `int`, found `Literal["a"]` +generics_scoping.py:49:1: error[type-assertion-failure] Type `Literal["abc"]` does not match asserted type `str` +generics_scoping.py:53:1: error[type-assertion-failure] Type `Literal[b"abc"]` does not match asserted type `bytes` +generics_scoping.py:61:13: error[unbound-type-variable] Type variable `S` is not bound to any outer generic context +generics_scoping.py:65:19: error[unbound-type-variable] Type variable `S` is not bound to any outer generic context +generics_scoping.py:76:11: error[shadowed-type-variable] Generic class `MyGeneric` uses type variable `T` already bound by an enclosing scope +generics_scoping.py:76:11: error[shadowed-type-variable] Generic class `MyGeneric` uses type variable `T` already bound by an enclosing scope +generics_scoping.py:86:11: error[shadowed-type-variable] Generic class `Bad` uses type variable `T` already bound by an enclosing scope +generics_scoping.py:89:17: error[unbound-type-variable] Type variable `T` is not bound to any outer generic context +generics_scoping.py:105:14: error[unbound-type-variable] Type variable `T` is not bound to any outer generic context +generics_scoping.py:106:19: error[unbound-type-variable] Type variable `T` is not bound to any outer generic context +""" diff --git a/conformance/results/ty/generics_self_advanced.toml b/conformance/results/ty/generics_self_advanced.toml new file mode 100644 index 00000000..cdd4d0cd --- /dev/null +++ b/conformance/results/ty/generics_self_advanced.toml @@ -0,0 +1,5 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +""" diff --git a/conformance/results/ty/generics_self_attributes.toml b/conformance/results/ty/generics_self_attributes.toml new file mode 100644 index 00000000..cca34273 --- /dev/null +++ b/conformance/results/ty/generics_self_attributes.toml @@ -0,0 +1,7 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +generics_self_attributes.py:26:33: error[invalid-argument-type] Argument is incorrect: Expected `OrdinalLinkedList | None`, found `LinkedList[int]` +generics_self_attributes.py:32:5: error[invalid-assignment] Object of type `LinkedList[int]` is not assignable to attribute `next` of type `OrdinalLinkedList | None` +""" diff --git a/conformance/results/ty/generics_self_basic.toml b/conformance/results/ty/generics_self_basic.toml new file mode 100644 index 00000000..7e56f458 --- /dev/null +++ b/conformance/results/ty/generics_self_basic.toml @@ -0,0 +1,8 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +generics_self_basic.py:20:16: error[invalid-return-type] Return type does not match returned value: expected `Self@method2`, found `Shape` +generics_self_basic.py:33:16: error[invalid-return-type] Return type does not match returned value: expected `Self@cls_method2`, found `Shape` +generics_self_basic.py:68:26: error[invalid-type-form] Special form `typing.Self` expected no type parameter +""" diff --git a/conformance/results/ty/generics_self_protocols.toml b/conformance/results/ty/generics_self_protocols.toml new file mode 100644 index 00000000..5d9cc9a0 --- /dev/null +++ b/conformance/results/ty/generics_self_protocols.toml @@ -0,0 +1,7 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +generics_self_protocols.py:61:19: error[invalid-argument-type] Argument to function `accepts_shape` is incorrect: Expected `ShapeProtocol`, found `BadReturnType` +generics_self_protocols.py:64:19: error[invalid-argument-type] Argument to function `accepts_shape` is incorrect: Expected `ShapeProtocol`, found `ReturnDifferentClass` +""" diff --git a/conformance/results/ty/generics_self_usage.toml b/conformance/results/ty/generics_self_usage.toml new file mode 100644 index 00000000..570bd172 --- /dev/null +++ b/conformance/results/ty/generics_self_usage.toml @@ -0,0 +1,22 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not reject `Self` used in a return annotation when `self` is annotated using another type variable. +Does not reject `Self` used in staticmethods or metaclasses. +""" +errors_diff = """ +Line 82: Expected 1 errors +Line 113: Expected 1 errors +Line 118: Expected 1 errors +Line 123: Expected 1 errors +Line 127: Expected 1 errors +""" +output = """ +generics_self_usage.py:73:14: error[invalid-type-form] Variable of type `` is not allowed in a type expression +generics_self_usage.py:73:23: error[invalid-type-form] Variable of type `` is not allowed in a type expression +generics_self_usage.py:76:6: error[invalid-type-form] Variable of type `` is not allowed in a type expression +generics_self_usage.py:87:16: error[invalid-return-type] Return type does not match returned value: expected `Self@return_concrete_type`, found `Foo3` +generics_self_usage.py:103:15: error[invalid-type-form] Variable of type `` is not allowed in a type expression +generics_self_usage.py:105:12: error[invalid-base] Invalid class base with type `` +generics_self_usage.py:108:30: error[invalid-type-form] Variable of type `` is not allowed in a type expression +""" diff --git a/conformance/results/ty/generics_syntax_compatibility.toml b/conformance/results/ty/generics_syntax_compatibility.toml new file mode 100644 index 00000000..51432fe8 --- /dev/null +++ b/conformance/results/ty/generics_syntax_compatibility.toml @@ -0,0 +1,8 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 14: Expected 1 errors +Line 26: Expected 1 errors +""" +output = """ +""" diff --git a/conformance/results/ty/generics_syntax_declarations.toml b/conformance/results/ty/generics_syntax_declarations.toml new file mode 100644 index 00000000..aa91df3b --- /dev/null +++ b/conformance/results/ty/generics_syntax_declarations.toml @@ -0,0 +1,15 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +generics_syntax_declarations.py:17:1: error[invalid-generic-class] Cannot both inherit from `typing.Generic` and use PEP 695 type variables +generics_syntax_declarations.py:25:20: error[invalid-generic-class] Cannot both inherit from subscripted `Protocol` and use PEP 695 type variables +generics_syntax_declarations.py:32:9: error[unresolved-attribute] Object of type `T@ClassD` has no attribute `is_integer` +generics_syntax_declarations.py:44:21: error[invalid-type-variable-bound] TypeVar upper bound cannot be generic +generics_syntax_declarations.py:48:17: error[invalid-type-form] List literals are not allowed in this context in a type expression: Did you mean `tuple[str, int]`? +generics_syntax_declarations.py:60:17: error[invalid-type-variable-constraints] TypeVar must have at least two constrained types +generics_syntax_declarations.py:64:17: error[invalid-type-variable-constraints] TypeVar must have at least two constrained types +generics_syntax_declarations.py:71:17: error[invalid-type-form] Variable of type `tuple[, ]` is not allowed in a type expression +generics_syntax_declarations.py:75:18: error[invalid-type-form] Int literals are not allowed in this context in a type expression +generics_syntax_declarations.py:79:23: error[unresolved-reference] Name `S` used when not defined +""" diff --git a/conformance/results/ty/generics_syntax_infer_variance.toml b/conformance/results/ty/generics_syntax_infer_variance.toml new file mode 100644 index 00000000..2a6065e8 --- /dev/null +++ b/conformance/results/ty/generics_syntax_infer_variance.toml @@ -0,0 +1,38 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 15: Expected 1 errors +Line 17: Expected 1 errors +Line 28: Unexpected errors ['generics_syntax_infer_variance.py:28:37: error[invalid-assignment] Object of type `ShouldBeCovariant1[int]` is not assignable to `ShouldBeCovariant1[int | float]`'] +Line 46: Unexpected errors ['generics_syntax_infer_variance.py:46:37: error[invalid-assignment] Object of type `ShouldBeCovariant2[int]` is not assignable to `ShouldBeCovariant2[int | float]`'] +Line 55: Unexpected errors ['generics_syntax_infer_variance.py:55:37: error[invalid-assignment] Object of type `ShouldBeCovariant3[int]` is not assignable to `ShouldBeCovariant3[int | float]`'] +Line 84: Unexpected errors ['generics_syntax_infer_variance.py:84:36: error[invalid-assignment] Object of type `ShouldBeCovariant5[int]` is not assignable to `ShouldBeCovariant5[int | float]`'] +Line 92: Unexpected errors ['generics_syntax_infer_variance.py:92:9: error[invalid-assignment] Cannot assign to final attribute `x` on type `Self@__init__`'] +Line 95: Unexpected errors ['generics_syntax_infer_variance.py:95:36: error[invalid-assignment] Object of type `ShouldBeCovariant6[int]` is not assignable to `ShouldBeCovariant6[int | float]`'] +Line 166: Unexpected errors ['generics_syntax_infer_variance.py:166:43: error[invalid-assignment] Object of type `ShouldBeContravariant1[int | float]` is not assignable to `ShouldBeContravariant1[int]`'] +""" +output = """ +generics_syntax_infer_variance.py:28:37: error[invalid-assignment] Object of type `ShouldBeCovariant1[int]` is not assignable to `ShouldBeCovariant1[int | float]` +generics_syntax_infer_variance.py:29:35: error[invalid-assignment] Object of type `ShouldBeCovariant1[int | float]` is not assignable to `ShouldBeCovariant1[int]` +generics_syntax_infer_variance.py:46:37: error[invalid-assignment] Object of type `ShouldBeCovariant2[int]` is not assignable to `ShouldBeCovariant2[int | float]` +generics_syntax_infer_variance.py:47:35: error[invalid-assignment] Object of type `ShouldBeCovariant2[int | float]` is not assignable to `ShouldBeCovariant2[int]` +generics_syntax_infer_variance.py:55:37: error[invalid-assignment] Object of type `ShouldBeCovariant3[int]` is not assignable to `ShouldBeCovariant3[int | float]` +generics_syntax_infer_variance.py:56:35: error[invalid-assignment] Object of type `ShouldBeCovariant3[int | float]` is not assignable to `ShouldBeCovariant3[int]` +generics_syntax_infer_variance.py:84:36: error[invalid-assignment] Object of type `ShouldBeCovariant5[int]` is not assignable to `ShouldBeCovariant5[int | float]` +generics_syntax_infer_variance.py:85:34: error[invalid-assignment] Object of type `ShouldBeCovariant5[int | float]` is not assignable to `ShouldBeCovariant5[int]` +generics_syntax_infer_variance.py:92:9: error[invalid-assignment] Cannot assign to final attribute `x` on type `Self@__init__` +generics_syntax_infer_variance.py:95:36: error[invalid-assignment] Object of type `ShouldBeCovariant6[int]` is not assignable to `ShouldBeCovariant6[int | float]` +generics_syntax_infer_variance.py:96:34: error[invalid-assignment] Object of type `ShouldBeCovariant6[int | float]` is not assignable to `ShouldBeCovariant6[int]` +generics_syntax_infer_variance.py:112:38: error[invalid-assignment] Object of type `ShouldBeInvariant1[int]` is not assignable to `ShouldBeInvariant1[int | float]` +generics_syntax_infer_variance.py:113:36: error[invalid-assignment] Object of type `ShouldBeInvariant1[int | float]` is not assignable to `ShouldBeInvariant1[int]` +generics_syntax_infer_variance.py:127:38: error[invalid-assignment] Object of type `ShouldBeInvariant2[int]` is not assignable to `ShouldBeInvariant2[int | float]` +generics_syntax_infer_variance.py:128:36: error[invalid-assignment] Object of type `ShouldBeInvariant2[int | float]` is not assignable to `ShouldBeInvariant2[int]` +generics_syntax_infer_variance.py:135:43: error[invalid-assignment] Object of type `ShouldBeInvariant3[int, str]` is not assignable to `ShouldBeInvariant3[int | float, str]` +generics_syntax_infer_variance.py:136:41: error[invalid-assignment] Object of type `ShouldBeInvariant3[int | float, str]` is not assignable to `ShouldBeInvariant3[int, str]` +generics_syntax_infer_variance.py:137:43: error[invalid-assignment] Object of type `ShouldBeInvariant3[str, int]` is not assignable to `ShouldBeInvariant3[str, int | float]` +generics_syntax_infer_variance.py:138:41: error[invalid-assignment] Object of type `ShouldBeInvariant3[str, int | float]` is not assignable to `ShouldBeInvariant3[str, int]` +generics_syntax_infer_variance.py:146:38: error[invalid-assignment] Object of type `ShouldBeInvariant4[int]` is not assignable to `ShouldBeInvariant4[int | float]` +generics_syntax_infer_variance.py:154:38: error[invalid-assignment] Object of type `ShouldBeInvariant5[int]` is not assignable to `ShouldBeInvariant5[int | float]` +generics_syntax_infer_variance.py:165:45: error[invalid-assignment] Object of type `ShouldBeContravariant1[int]` is not assignable to `ShouldBeContravariant1[int | float]` +generics_syntax_infer_variance.py:166:43: error[invalid-assignment] Object of type `ShouldBeContravariant1[int | float]` is not assignable to `ShouldBeContravariant1[int]` +""" diff --git a/conformance/results/ty/generics_syntax_scoping.toml b/conformance/results/ty/generics_syntax_scoping.toml new file mode 100644 index 00000000..839a9eda --- /dev/null +++ b/conformance/results/ty/generics_syntax_scoping.toml @@ -0,0 +1,12 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +generics_syntax_scoping.py:14:20: error[invalid-type-variable-bound] TypeVar upper bound cannot be generic +generics_syntax_scoping.py:18:17: error[invalid-type-variable-bound] TypeVar upper bound cannot be generic +generics_syntax_scoping.py:35:7: error[unresolved-reference] Name `T` used when not defined +generics_syntax_scoping.py:44:17: error[unresolved-reference] Name `T` used when not defined +generics_syntax_scoping.py:92:9: error[shadowed-type-variable] Generic function `method1` uses type variable `T` already bound by an enclosing scope +generics_syntax_scoping.py:95:9: error[shadowed-type-variable] Generic function `method2` uses type variable `T` already bound by an enclosing scope +generics_syntax_scoping.py:98:9: error[shadowed-type-variable] Generic function `method3` uses type variable `T` already bound by an enclosing scope +""" diff --git a/conformance/results/ty/generics_type_erasure.toml b/conformance/results/ty/generics_type_erasure.toml new file mode 100644 index 00000000..552d2988 --- /dev/null +++ b/conformance/results/ty/generics_type_erasure.toml @@ -0,0 +1,16 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not reject access of generic instance variable from the class object. +""" +errors_diff = """ +Line 42: Expected 1 errors +Line 43: Expected 1 errors +Line 44: Expected 1 errors +Line 45: Expected 1 errors +Line 46: Expected 1 errors +""" +output = """ +generics_type_erasure.py:38:16: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `int | None`, found `Literal[""]` +generics_type_erasure.py:40:16: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `str | None`, found `Literal[0]` +""" diff --git a/conformance/results/ty/generics_typevartuple_args.toml b/conformance/results/ty/generics_typevartuple_args.toml new file mode 100644 index 00000000..e5cdebab --- /dev/null +++ b/conformance/results/ty/generics_typevartuple_args.toml @@ -0,0 +1,24 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Supports PEP-646 unpacked tuples but not TypeVarTuple. +""" +errors_diff = """ +Line 33: Expected 1 errors +Line 34: Expected 1 errors +Line 48: Expected 1 errors +Line 57: Expected 1 errors +Line 58: Expected 1 errors +Line 59: Expected 1 errors +Line 67: Expected 1 errors +Line 75: Expected 1 errors +Line 76: Expected 1 errors +Line 29: Unexpected errors ['generics_typevartuple_args.py:29:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int, str]`'] +Line 31: Unexpected errors ['generics_typevartuple_args.py:31:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[()]`'] +Line 32: Unexpected errors ['generics_typevartuple_args.py:32:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int, str]`'] +""" +output = """ +generics_typevartuple_args.py:29:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int, str]` +generics_typevartuple_args.py:31:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[()]` +generics_typevartuple_args.py:32:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int, str]` +""" diff --git a/conformance/results/ty/generics_typevartuple_basic.toml b/conformance/results/ty/generics_typevartuple_basic.toml new file mode 100644 index 00000000..5274b4ba --- /dev/null +++ b/conformance/results/ty/generics_typevartuple_basic.toml @@ -0,0 +1,23 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 43: Expected 1 errors +Line 53: Expected 1 errors +Line 56: Expected 1 errors +Line 59: Expected 1 errors +Line 89: Expected 1 errors +Line 90: Expected 1 errors +Line 99: Expected 1 errors +Line 100: Expected 1 errors +Line 106: Expected 1 errors +Lines 44, 45: Expected error (tag 'v6') +Line 84: Unexpected errors ['generics_typevartuple_basic.py:84:1: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int]`'] +""" +output = """ +generics_typevartuple_basic.py:42:34: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `tuple[@Todo(TypeVarTuple), ...]`, found `Height` +generics_typevartuple_basic.py:52:14: error[invalid-generic-class] `TypeVarTuple` must be unpacked with `*` or `Unpack[]` when used as an argument to `Generic` +generics_typevartuple_basic.py:65:27: error[unknown-argument] Argument `covariant` does not match any known parameter of function `__new__` +generics_typevartuple_basic.py:66:27: error[too-many-positional-arguments] Too many positional arguments to function `__new__`: expected 2, got 4 +generics_typevartuple_basic.py:67:27: error[unknown-argument] Argument `bound` does not match any known parameter of function `__new__` +generics_typevartuple_basic.py:84:1: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int]` +""" diff --git a/conformance/results/ty/generics_typevartuple_callable.toml b/conformance/results/ty/generics_typevartuple_callable.toml new file mode 100644 index 00000000..223d59b3 --- /dev/null +++ b/conformance/results/ty/generics_typevartuple_callable.toml @@ -0,0 +1,13 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 26: Expected 1 errors +Line 41: Unexpected errors ['generics_typevartuple_callable.py:41:1: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[str, int, int | float | complex]`'] +Line 42: Unexpected errors ['generics_typevartuple_callable.py:42:1: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[str]`'] +Line 50: Unexpected errors ['generics_typevartuple_callable.py:50:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int | float | complex, str, int | float]`'] +""" +output = """ +generics_typevartuple_callable.py:41:1: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[str, int, int | float | complex]` +generics_typevartuple_callable.py:42:1: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[str]` +generics_typevartuple_callable.py:50:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int | float | complex, str, int | float]` +""" diff --git a/conformance/results/ty/generics_typevartuple_concat.toml b/conformance/results/ty/generics_typevartuple_concat.toml new file mode 100644 index 00000000..6d04be1f --- /dev/null +++ b/conformance/results/ty/generics_typevartuple_concat.toml @@ -0,0 +1,8 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 52: Unexpected errors ['generics_typevartuple_concat.py:52:1: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int, bool, str]`'] +""" +output = """ +generics_typevartuple_concat.py:52:1: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int, bool, str]` +""" diff --git a/conformance/results/ty/generics_typevartuple_overloads.toml b/conformance/results/ty/generics_typevartuple_overloads.toml new file mode 100644 index 00000000..cdd4d0cd --- /dev/null +++ b/conformance/results/ty/generics_typevartuple_overloads.toml @@ -0,0 +1,5 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +""" diff --git a/conformance/results/ty/generics_typevartuple_specialization.toml b/conformance/results/ty/generics_typevartuple_specialization.toml new file mode 100644 index 00000000..02c7eac9 --- /dev/null +++ b/conformance/results/ty/generics_typevartuple_specialization.toml @@ -0,0 +1,44 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 109: Expected 1 errors +Line 110: Expected 1 errors +Line 127: Expected 1 errors +Line 163: Expected 1 errors +Line 45: Unexpected errors ["generics_typevartuple_specialization.py:45:40: error[not-subscriptable] Cannot subscript non-generic type ``"] +Line 46: Unexpected errors ['generics_typevartuple_specialization.py:46:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int, int | float, bool]`'] +Line 47: Unexpected errors ['generics_typevartuple_specialization.py:47:5: error[type-assertion-failure] Type `Unknown` does not match asserted type `tuple[str, @Todo]`'] +Line 51: Unexpected errors ['generics_typevartuple_specialization.py:51:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int]`'] +Line 52: Unexpected errors ['generics_typevartuple_specialization.py:52:37: error[invalid-type-form] Tuple literals are not allowed in this context in a type expression: Did you mean `tuple[()]`?'] +Line 93: Unexpected errors ['generics_typevartuple_specialization.py:93:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[str, int]`'] +Line 94: Unexpected errors ['generics_typevartuple_specialization.py:94:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int | float]`'] +Line 95: Unexpected errors ['generics_typevartuple_specialization.py:95:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[Any, *tuple[Any, ...]]`'] +Line 135: Unexpected errors ['generics_typevartuple_specialization.py:135:5: error[type-assertion-failure] Type `tuple[tuple[@Todo(TypeVarTuple), ...], Unknown, Unknown]` does not match asserted type `tuple[tuple[()], str, bool]`'] +Line 136: Unexpected errors ['generics_typevartuple_specialization.py:136:5: error[type-assertion-failure] Type `tuple[tuple[@Todo(TypeVarTuple), ...], Unknown, Unknown]` does not match asserted type `tuple[tuple[str], bool, int | float]`'] +Line 137: Unexpected errors ['generics_typevartuple_specialization.py:137:5: error[type-assertion-failure] Type `tuple[tuple[@Todo(TypeVarTuple), ...], Unknown, Unknown]` does not match asserted type `tuple[tuple[str, bool], int | float, int]`'] +Line 148: Unexpected errors ['generics_typevartuple_specialization.py:148:5: error[type-assertion-failure] Type `tuple[tuple[@Todo(TypeVarTuple), ...], Unknown, Unknown, Unknown]` does not match asserted type `tuple[tuple[()], str, bool, int | float]`'] +Line 149: Unexpected errors ['generics_typevartuple_specialization.py:149:5: error[type-assertion-failure] Type `tuple[tuple[@Todo(TypeVarTuple), ...], Unknown, Unknown, Unknown]` does not match asserted type `tuple[tuple[bool], str, int | float, int]`'] +Line 157: Unexpected errors ['generics_typevartuple_specialization.py:157:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[*tuple[int, ...], int]`'] +Line 158: Unexpected errors ['generics_typevartuple_specialization.py:158:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[*tuple[int, ...], str]`'] +Line 159: Unexpected errors ['generics_typevartuple_specialization.py:159:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[*tuple[int, ...], str]`'] +""" +output = """ +generics_typevartuple_specialization.py:45:40: error[not-subscriptable] Cannot subscript non-generic type `` +generics_typevartuple_specialization.py:46:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int, int | float, bool]` +generics_typevartuple_specialization.py:47:5: error[type-assertion-failure] Type `Unknown` does not match asserted type `tuple[str, @Todo]` +generics_typevartuple_specialization.py:51:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int]` +generics_typevartuple_specialization.py:52:37: error[invalid-type-form] Tuple literals are not allowed in this context in a type expression: Did you mean `tuple[()]`? +generics_typevartuple_specialization.py:93:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[str, int]` +generics_typevartuple_specialization.py:94:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[int | float]` +generics_typevartuple_specialization.py:95:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[Any, *tuple[Any, ...]]` +generics_typevartuple_specialization.py:121:7: error[invalid-type-form] Multiple unpacked variadic tuples are not allowed in a `tuple` specialization +generics_typevartuple_specialization.py:122:7: error[invalid-type-form] Multiple unpacked variadic tuples are not allowed in a `tuple` specialization +generics_typevartuple_specialization.py:135:5: error[type-assertion-failure] Type `tuple[tuple[@Todo(TypeVarTuple), ...], Unknown, Unknown]` does not match asserted type `tuple[tuple[()], str, bool]` +generics_typevartuple_specialization.py:136:5: error[type-assertion-failure] Type `tuple[tuple[@Todo(TypeVarTuple), ...], Unknown, Unknown]` does not match asserted type `tuple[tuple[str], bool, int | float]` +generics_typevartuple_specialization.py:137:5: error[type-assertion-failure] Type `tuple[tuple[@Todo(TypeVarTuple), ...], Unknown, Unknown]` does not match asserted type `tuple[tuple[str, bool], int | float, int]` +generics_typevartuple_specialization.py:148:5: error[type-assertion-failure] Type `tuple[tuple[@Todo(TypeVarTuple), ...], Unknown, Unknown, Unknown]` does not match asserted type `tuple[tuple[()], str, bool, int | float]` +generics_typevartuple_specialization.py:149:5: error[type-assertion-failure] Type `tuple[tuple[@Todo(TypeVarTuple), ...], Unknown, Unknown, Unknown]` does not match asserted type `tuple[tuple[bool], str, int | float, int]` +generics_typevartuple_specialization.py:157:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[*tuple[int, ...], int]` +generics_typevartuple_specialization.py:158:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[*tuple[int, ...], str]` +generics_typevartuple_specialization.py:159:5: error[type-assertion-failure] Type `tuple[@Todo(TypeVarTuple), ...]` does not match asserted type `tuple[*tuple[int, ...], str]` +""" diff --git a/conformance/results/ty/generics_typevartuple_unpack.toml b/conformance/results/ty/generics_typevartuple_unpack.toml new file mode 100644 index 00000000..d22971b5 --- /dev/null +++ b/conformance/results/ty/generics_typevartuple_unpack.toml @@ -0,0 +1,7 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 30: Expected 1 errors +""" +output = """ +""" diff --git a/conformance/results/ty/generics_upper_bound.toml b/conformance/results/ty/generics_upper_bound.toml new file mode 100644 index 00000000..47ea50c5 --- /dev/null +++ b/conformance/results/ty/generics_upper_bound.toml @@ -0,0 +1,10 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +generics_upper_bound.py:24:32: error[invalid-type-variable-bound] TypeVar upper bound cannot be generic +generics_upper_bound.py:44:5: error[type-assertion-failure] Type `list[int] | set[int]` does not match asserted type `Collection[int]` +generics_upper_bound.py:52:8: error[invalid-argument-type] Argument to function `longer` is incorrect: Argument type `Literal[3]` does not satisfy upper bound `Sized` of type variable `ST` +generics_upper_bound.py:52:11: error[invalid-argument-type] Argument to function `longer` is incorrect: Argument type `Literal[3]` does not satisfy upper bound `Sized` of type variable `ST` +generics_upper_bound.py:57:10: error[invalid-legacy-type-variable] A `TypeVar` cannot have both a bound and constraints +""" diff --git a/conformance/results/ty/generics_variance.toml b/conformance/results/ty/generics_variance.toml new file mode 100644 index 00000000..4193f749 --- /dev/null +++ b/conformance/results/ty/generics_variance.toml @@ -0,0 +1,19 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 77: Expected 1 errors +Line 81: Expected 1 errors +Line 93: Expected 1 errors +Line 105: Expected 1 errors +Line 113: Expected 1 errors +Line 163: Expected 1 errors +Line 167: Expected 1 errors +Line 191: Expected 1 errors +Lines 125, 126: Expected error (tag 'CoContra_Child2') +Lines 131, 132: Expected error (tag 'CoContra_Child3') +Lines 141, 142: Expected error (tag 'CoContra_Child5') +Lines 195, 196: Expected error (tag 'ContraToContraToContra_WithTA') +""" +output = """ +generics_variance.py:14:6: error[invalid-legacy-type-variable] A `TypeVar` cannot be both covariant and contravariant +""" diff --git a/conformance/results/ty/generics_variance_inference.toml b/conformance/results/ty/generics_variance_inference.toml new file mode 100644 index 00000000..1c637eec --- /dev/null +++ b/conformance/results/ty/generics_variance_inference.toml @@ -0,0 +1,28 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +generics_variance_inference.py:24:33: error[invalid-assignment] Object of type `ClassA[int | float, int, int]` is not assignable to `ClassA[int, int, int]` +generics_variance_inference.py:25:37: error[invalid-assignment] Object of type `ClassA[int | float, int, int]` is not assignable to `ClassA[int | float, int | float, int]` +generics_variance_inference.py:28:33: error[invalid-assignment] Object of type `ClassA[int, int | float, int | float]` is not assignable to `ClassA[int, int, int]` +generics_variance_inference.py:41:35: error[invalid-assignment] Object of type `ShouldBeCovariant1[int | float]` is not assignable to `ShouldBeCovariant1[int]` +generics_variance_inference.py:49:35: error[invalid-assignment] Object of type `ShouldBeCovariant2[int | float]` is not assignable to `ShouldBeCovariant2[int]` +generics_variance_inference.py:58:35: error[invalid-assignment] Object of type `ShouldBeCovariant3[int | float]` is not assignable to `ShouldBeCovariant3[int]` +generics_variance_inference.py:67:34: error[invalid-assignment] Object of type `ShouldBeCovariant4[int | float]` is not assignable to `ShouldBeCovariant4[int]` +generics_variance_inference.py:80:34: error[invalid-assignment] Object of type `ShouldBeCovariant5[int | float]` is not assignable to `ShouldBeCovariant5[int]` +generics_variance_inference.py:96:38: error[invalid-assignment] Object of type `ShouldBeInvariant1[int]` is not assignable to `ShouldBeInvariant1[int | float]` +generics_variance_inference.py:97:36: error[invalid-assignment] Object of type `ShouldBeInvariant1[int | float]` is not assignable to `ShouldBeInvariant1[int]` +generics_variance_inference.py:111:38: error[invalid-assignment] Object of type `ShouldBeInvariant2[int]` is not assignable to `ShouldBeInvariant2[int | float]` +generics_variance_inference.py:112:36: error[invalid-assignment] Object of type `ShouldBeInvariant2[int | float]` is not assignable to `ShouldBeInvariant2[int]` +generics_variance_inference.py:119:43: error[invalid-assignment] Object of type `ShouldBeInvariant3[int, str]` is not assignable to `ShouldBeInvariant3[int | float, str]` +generics_variance_inference.py:120:41: error[invalid-assignment] Object of type `ShouldBeInvariant3[int | float, str]` is not assignable to `ShouldBeInvariant3[int, str]` +generics_variance_inference.py:121:43: error[invalid-assignment] Object of type `ShouldBeInvariant3[str, int]` is not assignable to `ShouldBeInvariant3[str, int | float]` +generics_variance_inference.py:122:41: error[invalid-assignment] Object of type `ShouldBeInvariant3[str, int | float]` is not assignable to `ShouldBeInvariant3[str, int]` +generics_variance_inference.py:130:38: error[invalid-assignment] Object of type `ShouldBeInvariant4[int]` is not assignable to `ShouldBeInvariant4[int | float]` +generics_variance_inference.py:138:38: error[invalid-assignment] Object of type `ShouldBeInvariant5[int]` is not assignable to `ShouldBeInvariant5[int | float]` +generics_variance_inference.py:149:45: error[invalid-assignment] Object of type `ShouldBeContravariant1[int]` is not assignable to `ShouldBeContravariant1[int | float]` +generics_variance_inference.py:169:31: error[invalid-assignment] Object of type `ShouldBeInvariant6[int | float]` is not assignable to `ShouldBeInvariant6[int]` +generics_variance_inference.py:170:33: error[invalid-assignment] Object of type `ShouldBeInvariant6[int]` is not assignable to `ShouldBeInvariant6[int | float]` +generics_variance_inference.py:181:31: error[invalid-assignment] Object of type `ShouldBeCovariant6[int | float]` is not assignable to `ShouldBeCovariant6[int]` +generics_variance_inference.py:194:37: error[invalid-assignment] Object of type `ShouldBeContravariant2[int]` is not assignable to `ShouldBeContravariant2[int | float]` +""" diff --git a/conformance/results/ty/historical_positional.toml b/conformance/results/ty/historical_positional.toml new file mode 100644 index 00000000..bef65030 --- /dev/null +++ b/conformance/results/ty/historical_positional.toml @@ -0,0 +1,10 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +historical_positional.py:18:4: error[positional-only-parameter-as-kwarg] Positional-only parameter 1 (`__x`) passed as keyword argument of function `f1` +historical_positional.py:26:16: error[invalid-legacy-positional-parameter] Invalid use of the legacy convention for positional-only parameters: Parameter name begins with `__` but will not be treated as positional-only +historical_positional.py:45:28: error[invalid-legacy-positional-parameter] Invalid use of the legacy convention for positional-only parameters: Parameter name begins with `__` but will not be treated as positional-only +historical_positional.py:54:26: error[invalid-legacy-positional-parameter] Invalid use of the legacy convention for positional-only parameters: Parameter name begins with `__` but will not be treated as positional-only +historical_positional.py:59:6: error[positional-only-parameter-as-kwarg] Positional-only parameter 2 (`__x`) passed as keyword argument of bound method `m1` +""" diff --git a/conformance/results/ty/literals_interactions.toml b/conformance/results/ty/literals_interactions.toml new file mode 100644 index 00000000..354e5a8f --- /dev/null +++ b/conformance/results/ty/literals_interactions.toml @@ -0,0 +1,17 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Deliberately does not allow `str` to be narrowed to literal string types through equality or containment checks due to the possibility of `str` subclasses that could have unexpected equality semantics. +""" +errors_diff = """ +Line 106: Unexpected errors ['literals_interactions.py:106:35: error[invalid-argument-type] Argument to function `expects_bad_status` is incorrect: Expected `Literal["MALFORMED", "ABORTED"]`, found `str`'] +Line 109: Unexpected errors ['literals_interactions.py:109:32: error[invalid-argument-type] Argument to function `expects_pending_status` is incorrect: Expected `Literal["PENDING"]`, found `str`'] +""" +output = """ +literals_interactions.py:15:5: error[index-out-of-bounds] Index 5 is out of bounds for tuple `tuple[int, str, list[bool]]` with length 3 +literals_interactions.py:16:5: error[index-out-of-bounds] Index -5 is out of bounds for tuple `tuple[int, str, list[bool]]` with length 3 +literals_interactions.py:17:5: error[index-out-of-bounds] Index 4 is out of bounds for tuple `tuple[int, str, list[bool]]` with length 3 +literals_interactions.py:18:5: error[index-out-of-bounds] Index -4 is out of bounds for tuple `tuple[int, str, list[bool]]` with length 3 +literals_interactions.py:106:35: error[invalid-argument-type] Argument to function `expects_bad_status` is incorrect: Expected `Literal["MALFORMED", "ABORTED"]`, found `str` +literals_interactions.py:109:32: error[invalid-argument-type] Argument to function `expects_pending_status` is incorrect: Expected `Literal["PENDING"]`, found `str` +""" diff --git a/conformance/results/ty/literals_literalstring.toml b/conformance/results/ty/literals_literalstring.toml new file mode 100644 index 00000000..052d2d4c --- /dev/null +++ b/conformance/results/ty/literals_literalstring.toml @@ -0,0 +1,15 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +literals_literalstring.py:36:29: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_literalstring.py:37:22: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_literalstring.py:43:23: error[invalid-assignment] Object of type `Literal["two"]` is not assignable to `Literal[""]` +literals_literalstring.py:65:25: error[invalid-assignment] Object of type `str` is not assignable to `LiteralString` +literals_literalstring.py:73:25: error[invalid-assignment] Object of type `Literal[3]` is not assignable to `LiteralString` +literals_literalstring.py:74:25: error[invalid-assignment] Object of type `Literal[b"test"]` is not assignable to `LiteralString` +literals_literalstring.py:119:22: error[invalid-argument-type] Argument to function `literal_identity` is incorrect: Argument type `str` does not satisfy upper bound `LiteralString` of type variable `TLiteral` +literals_literalstring.py:133:51: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Argument type `str` does not satisfy upper bound `LiteralString` of type variable `T` +literals_literalstring.py:133:51: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `LiteralString`, found `str` +literals_literalstring.py:170:21: error[invalid-assignment] Object of type `list[LiteralString]` is not assignable to `list[str]` +""" diff --git a/conformance/results/ty/literals_parameterizations.toml b/conformance/results/ty/literals_parameterizations.toml new file mode 100644 index 00000000..27f64295 --- /dev/null +++ b/conformance/results/ty/literals_parameterizations.toml @@ -0,0 +1,22 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +literals_parameterizations.py:41:15: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_parameterizations.py:42:15: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_parameterizations.py:43:15: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_parameterizations.py:44:15: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_parameterizations.py:45:15: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_parameterizations.py:46:15: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_parameterizations.py:47:15: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_parameterizations.py:48:15: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_parameterizations.py:49:15: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_parameterizations.py:50:16: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_parameterizations.py:51:16: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_parameterizations.py:52:16: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_parameterizations.py:53:16: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_parameterizations.py:56:28: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_parameterizations.py:60:4: error[invalid-type-form] `typing.Literal` requires at least one argument when used in a type expression +literals_parameterizations.py:61:12: error[invalid-type-form] Type arguments for `Literal` must be `None`, a literal value (int, bool, str, or bytes), or an enum member +literals_parameterizations.py:65:32: error[invalid-assignment] Object of type `Literal[Color.RED]` is not assignable to `Literal["Color.RED"]` +""" diff --git a/conformance/results/ty/literals_semantics.toml b/conformance/results/ty/literals_semantics.toml new file mode 100644 index 00000000..f0a0bb5f --- /dev/null +++ b/conformance/results/ty/literals_semantics.toml @@ -0,0 +1,9 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +literals_semantics.py:10:18: error[invalid-assignment] Object of type `Literal[4]` is not assignable to `Literal[3]` +literals_semantics.py:24:26: error[invalid-assignment] Object of type `Literal[0]` is not assignable to `Literal[False]` +literals_semantics.py:25:22: error[invalid-assignment] Object of type `Literal[False]` is not assignable to `Literal[0]` +literals_semantics.py:33:5: error[invalid-assignment] Object of type `Literal[6, 7, 8]` is not assignable to `Literal[3, 4, 5]` +""" diff --git a/conformance/results/ty/namedtuples_define_class.toml b/conformance/results/ty/namedtuples_define_class.toml new file mode 100644 index 00000000..df2ada36 --- /dev/null +++ b/conformance/results/ty/namedtuples_define_class.toml @@ -0,0 +1,23 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Permits subclasses of `NamedTuple` classes to override read-only attributes in the class body of the subclass. +""" +errors_diff = """ +Line 106: Expected 1 errors +""" +output = """ +namedtuples_define_class.py:32:7: error[index-out-of-bounds] Index 3 is out of bounds for tuple `Point` with length 3 +namedtuples_define_class.py:33:7: error[index-out-of-bounds] Index -4 is out of bounds for tuple `Point` with length 3 +namedtuples_define_class.py:44:6: error[missing-argument] No argument provided for required parameter `y` +namedtuples_define_class.py:45:6: error[missing-argument] No argument provided for required parameter `y` +namedtuples_define_class.py:46:15: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal[""]` +namedtuples_define_class.py:47:18: error[invalid-argument-type] Argument is incorrect: Expected `str`, found `Literal[3]` +namedtuples_define_class.py:48:22: error[too-many-positional-arguments] Too many positional arguments: expected 4, got 5 +namedtuples_define_class.py:49:23: error[unknown-argument] Argument `other` does not match any known parameter +namedtuples_define_class.py:69:20: error[too-many-positional-arguments] Too many positional arguments: expected 3, got 4 +namedtuples_define_class.py:76:5: error[invalid-named-tuple] NamedTuple field `_y` cannot start with an underscore +namedtuples_define_class.py:86:5: error[invalid-named-tuple] NamedTuple field without default value cannot follow field(s) with default value(s): Field `latitude` defined here without a default value +namedtuples_define_class.py:125:19: error[invalid-argument-type] Argument is incorrect: Expected `str`, found `float` +namedtuples_define_class.py:132:24: error[invalid-named-tuple] NamedTuple class `Unit` cannot use multiple inheritance except with `Generic[]` +""" diff --git a/conformance/results/ty/namedtuples_define_functional.toml b/conformance/results/ty/namedtuples_define_functional.toml new file mode 100644 index 00000000..dc85a1e4 --- /dev/null +++ b/conformance/results/ty/namedtuples_define_functional.toml @@ -0,0 +1,19 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +namedtuples_define_functional.py:16:8: error[missing-argument] No argument provided for required parameter `y` +namedtuples_define_functional.py:21:8: error[missing-argument] No arguments provided for required parameters `x`, `y` +namedtuples_define_functional.py:26:21: error[too-many-positional-arguments] Too many positional arguments: expected 3, got 4 +namedtuples_define_functional.py:31:8: error[missing-argument] No argument provided for required parameter `y` +namedtuples_define_functional.py:31:18: error[unknown-argument] Argument `z` does not match any known parameter +namedtuples_define_functional.py:36:18: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["1"]` +namedtuples_define_functional.py:37:21: error[too-many-positional-arguments] Too many positional arguments: expected 3, got 4 +namedtuples_define_functional.py:42:18: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal["1"]` +namedtuples_define_functional.py:43:15: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `float` +namedtuples_define_functional.py:52:25: error[invalid-named-tuple] Duplicate field name `a` in `namedtuple()`: Field `a` already defined; will raise `ValueError` at runtime +namedtuples_define_functional.py:53:25: error[invalid-named-tuple] Field name `def` in `namedtuple()` cannot be a Python keyword: Will raise `ValueError` at runtime +namedtuples_define_functional.py:54:25: error[invalid-named-tuple] Field name `def` in `namedtuple()` cannot be a Python keyword: Will raise `ValueError` at runtime +namedtuples_define_functional.py:55:25: error[invalid-named-tuple] Field name `_d` in `namedtuple()` cannot start with an underscore: Will raise `ValueError` at runtime +namedtuples_define_functional.py:69:1: error[missing-argument] No argument provided for required parameter `a` +""" diff --git a/conformance/results/ty/namedtuples_type_compat.toml b/conformance/results/ty/namedtuples_type_compat.toml new file mode 100644 index 00000000..1003a325 --- /dev/null +++ b/conformance/results/ty/namedtuples_type_compat.toml @@ -0,0 +1,7 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +namedtuples_type_compat.py:22:23: error[invalid-assignment] Object of type `Point` is not assignable to `tuple[int, int]` +namedtuples_type_compat.py:23:28: error[invalid-assignment] Object of type `Point` is not assignable to `tuple[int, str, str]` +""" diff --git a/conformance/results/ty/namedtuples_usage.toml b/conformance/results/ty/namedtuples_usage.toml new file mode 100644 index 00000000..c7c4e087 --- /dev/null +++ b/conformance/results/ty/namedtuples_usage.toml @@ -0,0 +1,17 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not detect runtime errors from attempting to delete namedtuple attributes. +""" +errors_diff = """ +Line 42: Expected 1 errors +""" +output = """ +namedtuples_usage.py:34:7: error[index-out-of-bounds] Index 3 is out of bounds for tuple `Point` with length 3 +namedtuples_usage.py:35:7: error[index-out-of-bounds] Index -4 is out of bounds for tuple `Point` with length 3 +namedtuples_usage.py:40:1: error[invalid-assignment] Cannot assign to read-only property `x` on object of type `Point` +namedtuples_usage.py:41:1: error[invalid-assignment] Cannot assign to a subscript on an object of type `Point` +namedtuples_usage.py:43:5: error[not-subscriptable] Cannot delete subscript on object of type `Point` with no `__delitem__` method +namedtuples_usage.py:52:1: error[invalid-assignment] Too many values to unpack: Expected 2 +namedtuples_usage.py:53:1: error[invalid-assignment] Not enough values to unpack: Expected 4 +""" diff --git a/conformance/results/ty/narrowing_typeguard.toml b/conformance/results/ty/narrowing_typeguard.toml new file mode 100644 index 00000000..196a4194 --- /dev/null +++ b/conformance/results/ty/narrowing_typeguard.toml @@ -0,0 +1,9 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +narrowing_typeguard.py:102:23: error[invalid-type-guard-definition] `TypeGuard` function must have a parameter to narrow +narrowing_typeguard.py:107:22: error[invalid-type-guard-definition] `TypeGuard` function must have a parameter to narrow +narrowing_typeguard.py:128:20: error[invalid-argument-type] Argument to function `takes_callable_str` is incorrect: Expected `(object, /) -> str`, found `def simple_typeguard(val: object) -> TypeGuard[int]` +narrowing_typeguard.py:148:26: error[invalid-argument-type] Argument to function `takes_callable_str_proto` is incorrect: Expected `CallableStrProto`, found `def simple_typeguard(val: object) -> TypeGuard[int]` +""" diff --git a/conformance/results/ty/narrowing_typeis.toml b/conformance/results/ty/narrowing_typeis.toml new file mode 100644 index 00000000..5cabfbbc --- /dev/null +++ b/conformance/results/ty/narrowing_typeis.toml @@ -0,0 +1,20 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Intersects the pre-existing type with the top materialization of the bracketed type rather than the bracketed type itself. +""" +errors_diff = """ +Line 35: Unexpected errors ['narrowing_typeis.py:35:18: error[invalid-assignment] Object of type `object` is not assignable to `int`'] +""" +output = """ +narrowing_typeis.py:35:18: error[invalid-assignment] Object of type `object` is not assignable to `int` +narrowing_typeis.py:105:23: error[invalid-type-guard-definition] `TypeIs` function must have a parameter to narrow +narrowing_typeis.py:110:22: error[invalid-type-guard-definition] `TypeIs` function must have a parameter to narrow +narrowing_typeis.py:132:20: error[invalid-argument-type] Argument to function `takes_callable_str` is incorrect: Expected `(object, /) -> str`, found `def simple_typeguard(val: object) -> TypeIs[int]` +narrowing_typeis.py:152:26: error[invalid-argument-type] Argument to function `takes_callable_str_proto` is incorrect: Expected `CallableStrProto`, found `def simple_typeguard(val: object) -> TypeIs[int]` +narrowing_typeis.py:169:17: error[invalid-argument-type] Argument to function `takes_typeguard` is incorrect: Expected `(object, /) -> TypeGuard[int]`, found `def is_int_typeis(val: object) -> TypeIs[int]` +narrowing_typeis.py:170:14: error[invalid-argument-type] Argument to function `takes_typeis` is incorrect: Expected `(object, /) -> TypeIs[int]`, found `def is_int_typeguard(val: object) -> TypeGuard[int]` +narrowing_typeis.py:191:18: error[invalid-argument-type] Argument to function `takes_int_typeis` is incorrect: Expected `(object, /) -> TypeIs[int]`, found `def bool_typeis(val: object) -> TypeIs[bool]` +narrowing_typeis.py:195:27: error[invalid-type-guard-definition] Narrowed type `str` is not assignable to the declared parameter type `int` +narrowing_typeis.py:199:45: error[invalid-type-guard-definition] Narrowed type `list[int]` is not assignable to the declared parameter type `list[object]` +""" diff --git a/conformance/results/ty/overloads_basic.toml b/conformance/results/ty/overloads_basic.toml new file mode 100644 index 00000000..eb874c74 --- /dev/null +++ b/conformance/results/ty/overloads_basic.toml @@ -0,0 +1,6 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +overloads_basic.py:39:1: error[invalid-argument-type] Method `__getitem__` of type `Overload[(__i: int, /) -> int, (__s: slice[Any, Any, Any], /) -> bytes]` cannot be called with key of type `Literal[""]` on object of type `Bytes` +""" diff --git a/conformance/results/ty/overloads_consistency.toml b/conformance/results/ty/overloads_consistency.toml new file mode 100644 index 00000000..85fcf0d2 --- /dev/null +++ b/conformance/results/ty/overloads_consistency.toml @@ -0,0 +1,8 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Lines 25, 28: Expected error (tag 'return_type') +Lines 41, 44: Expected error (tag 'parameter_type') +""" +output = """ +""" diff --git a/conformance/results/ty/overloads_definitions.toml b/conformance/results/ty/overloads_definitions.toml new file mode 100644 index 00000000..090f8fdf --- /dev/null +++ b/conformance/results/ty/overloads_definitions.toml @@ -0,0 +1,17 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +overloads_definitions.py:16:5: error[invalid-overload] Overloaded function `func1` requires at least two overloads: Only one overload defined here +overloads_definitions.py:28:5: error[invalid-overload] Overloads for function `func2` must be followed by a non-`@overload`-decorated implementation function +overloads_definitions.py:59:9: error[invalid-overload] Overloads for function `not_abstract` must be followed by a non-`@overload`-decorated implementation function +overloads_definitions.py:81:9: error[invalid-overload] Overloaded function `func5` does not use the `@staticmethod` decorator consistently +overloads_definitions.py:94:9: error[invalid-overload] Overloaded function `func6` does not use the `@classmethod` decorator consistently +overloads_definitions.py:124:9: error[invalid-overload] `@final` decorator should be applied only to the overload implementation +overloads_definitions.py:139:9: error[invalid-overload] `@final` decorator should be applied only to the overload implementation +overloads_definitions.py:144:9: error[invalid-overload] `@final` decorator should be applied only to the overload implementation +overloads_definitions.py:186:9: error[override-of-final-method] Cannot override final member `final_method` from superclass `Base` +overloads_definitions.py:203:9: error[invalid-explicit-override] Method `bad_override` is decorated with `@override` but does not override anything +overloads_definitions.py:228:9: error[invalid-overload] `@override` decorator should be applied only to the overload implementation +overloads_definitions.py:232:9: error[invalid-overload] `@override` decorator should be applied only to the overload implementation +""" diff --git a/conformance/results/ty/overloads_definitions_stub.toml b/conformance/results/ty/overloads_definitions_stub.toml new file mode 100644 index 00000000..43ec8fee --- /dev/null +++ b/conformance/results/ty/overloads_definitions_stub.toml @@ -0,0 +1,13 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +overloads_definitions_stub.pyi:14:5: error[invalid-overload] Overloaded function `func1` requires at least two overloads: Only one overload defined here +overloads_definitions_stub.pyi:37:9: error[invalid-overload] Overloaded function `func5` does not use the `@staticmethod` decorator consistently +overloads_definitions_stub.pyi:44:9: error[invalid-overload] Overloaded function `func6` does not use the `@classmethod` decorator consistently +overloads_definitions_stub.pyi:73:9: error[invalid-overload] `@final` decorator should be applied only to the first overload +overloads_definitions_stub.pyi:86:9: error[invalid-overload] `@final` decorator should be applied only to the first overload +overloads_definitions_stub.pyi:111:9: error[override-of-final-method] Cannot override final member `final_method` from superclass `Base` +overloads_definitions_stub.pyi:122:9: error[invalid-explicit-override] Method `bad_override` is decorated with `@override` but does not override anything +overloads_definitions_stub.pyi:147:9: error[invalid-overload] `@override` decorator should be applied only to the first overload +""" diff --git a/conformance/results/ty/overloads_evaluation.toml b/conformance/results/ty/overloads_evaluation.toml new file mode 100644 index 00000000..3a9a963c --- /dev/null +++ b/conformance/results/ty/overloads_evaluation.toml @@ -0,0 +1,9 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +overloads_evaluation.py:38:1: error[no-matching-overload] No overload of function `example1_1` matches arguments +overloads_evaluation.py:46:15: error[invalid-argument-type] Argument to function `example1_1` is incorrect: Expected `str`, found `Literal[1]` +overloads_evaluation.py:51:12: error[invalid-argument-type] Argument to function `example1_1` is incorrect: Expected `str`, found `Literal[1]` +overloads_evaluation.py:116:5: error[no-matching-overload] No overload of function `example2` matches arguments +""" diff --git a/conformance/results/ty/protocols_class_objects.toml b/conformance/results/ty/protocols_class_objects.toml new file mode 100644 index 00000000..fcc3ec8a --- /dev/null +++ b/conformance/results/ty/protocols_class_objects.toml @@ -0,0 +1,22 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +notes = """ +`type[Proto]` is not yet supported. +`ClassVar` protocol members are not yet supported. +`@property` protocol members are only partially supported. +A class object `C` is only considered to inhabit a protocol type with a method member `f` if `f` exists as an attribute on the metaclass of `C`. +""" +errors_diff = """ +Line 29: Expected 1 errors +Line 34: Expected 1 errors +Line 74: Expected 1 errors +Line 104: Expected 1 errors +Line 106: Expected 1 errors +Line 107: Expected 1 errors +Line 108: Expected 1 errors +Line 59: Unexpected errors ["protocols_class_objects.py:59:16: error[invalid-assignment] Object of type `` is not assignable to `ProtoA2`"] +""" +output = """ +protocols_class_objects.py:58:16: error[invalid-assignment] Object of type `` is not assignable to `ProtoA1` +protocols_class_objects.py:59:16: error[invalid-assignment] Object of type `` is not assignable to `ProtoA2` +""" diff --git a/conformance/results/ty/protocols_definition.toml b/conformance/results/ty/protocols_definition.toml new file mode 100644 index 00000000..5f8ae7f3 --- /dev/null +++ b/conformance/results/ty/protocols_definition.toml @@ -0,0 +1,33 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not reject implicit instance attributes in `Protocol` methods. +Does not support `ClassVar` protocol members. +Incorrectly considers `ClassVar` attributes on concrete classes as satisfying non-`ClassVar` attribute members on protocols. +Only has partial support for `@property` protocol members. +""" +errors_diff = """ +Line 67: Expected 1 errors +Line 117: Expected 1 errors +Line 157: Expected 1 errors +Line 158: Expected 1 errors +Line 218: Expected 1 errors +Line 339: Expected 1 errors +Line 340: Expected 1 errors +Line 341: Expected 1 errors +""" +output = """ +protocols_definition.py:30:11: error[invalid-argument-type] Argument to function `close_all` is incorrect: Expected `Iterable[SupportsClose]`, found `list[int]` +protocols_definition.py:114:22: error[invalid-assignment] Object of type `Concrete2_Bad1` is not assignable to `Template2` +protocols_definition.py:115:22: error[invalid-assignment] Object of type `Concrete2_Bad2` is not assignable to `Template2` +protocols_definition.py:116:22: error[invalid-assignment] Object of type `Concrete2_Bad3` is not assignable to `Template2` +protocols_definition.py:156:22: error[invalid-assignment] Object of type `Concrete3_Bad1` is not assignable to `Template3` +protocols_definition.py:159:22: error[invalid-assignment] Object of type `Concrete3_Bad4` is not assignable to `Template3` +protocols_definition.py:160:22: error[invalid-assignment] Object of type `Concrete3_Bad5` is not assignable to `Template3` +protocols_definition.py:219:22: error[invalid-assignment] Object of type `Concrete4_Bad2` is not assignable to `Template4` +protocols_definition.py:285:22: error[invalid-assignment] Object of type `Concrete5_Bad1` is not assignable to `Template5` +protocols_definition.py:286:22: error[invalid-assignment] Object of type `Concrete5_Bad2` is not assignable to `Template5` +protocols_definition.py:287:22: error[invalid-assignment] Object of type `Concrete5_Bad3` is not assignable to `Template5` +protocols_definition.py:288:22: error[invalid-assignment] Object of type `Concrete5_Bad4` is not assignable to `Template5` +protocols_definition.py:289:22: error[invalid-assignment] Object of type `Concrete5_Bad5` is not assignable to `Template5` +""" diff --git a/conformance/results/ty/protocols_explicit.toml b/conformance/results/ty/protocols_explicit.toml new file mode 100644 index 00000000..24f1e854 --- /dev/null +++ b/conformance/results/ty/protocols_explicit.toml @@ -0,0 +1,16 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +notes = """ +Allows implicitly abstract protocol methods to be called via `super()` on a protocol subclass. +Allows instantiation of abstract subclasses of protocol classes. +""" +errors_diff = """ +Line 27: Expected 1 errors +Line 60: Expected 1 errors +Line 89: Expected 1 errors +Line 134: Expected 1 errors +Line 164: Expected 1 errors +""" +output = """ +protocols_explicit.py:56:9: error[invalid-assignment] Object of type `tuple[int, int, str]` is not assignable to attribute `rgb` of type `tuple[int, int, int]` +""" diff --git a/conformance/results/ty/protocols_generic.toml b/conformance/results/ty/protocols_generic.toml new file mode 100644 index 00000000..96e3dbdc --- /dev/null +++ b/conformance/results/ty/protocols_generic.toml @@ -0,0 +1,18 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Only partially supports `@property` protocol members. +""" +errors_diff = """ +Line 145: Expected 1 errors +Line 146: Expected 1 errors +Line 147: Expected 1 errors +""" +output = """ +protocols_generic.py:40:24: error[invalid-assignment] Object of type `Concrete1` is not assignable to `Proto1[int, str]` +protocols_generic.py:44:14: error[invalid-generic-class] Cannot both inherit from subscripted `Protocol` and subscripted `Generic` +protocols_generic.py:56:20: error[invalid-assignment] Object of type `Box[int | float]` is not assignable to `Box[int]` +protocols_generic.py:66:25: error[invalid-assignment] Object of type `Sender[int]` is not assignable to `Sender[int | float]` +protocols_generic.py:74:28: error[invalid-assignment] Object of type `AttrProto[int]` is not assignable to `AttrProto[int | float]` +protocols_generic.py:75:26: error[invalid-assignment] Object of type `AttrProto[int | float]` is not assignable to `AttrProto[int]` +""" diff --git a/conformance/results/ty/protocols_merging.toml b/conformance/results/ty/protocols_merging.toml new file mode 100644 index 00000000..f3229e3f --- /dev/null +++ b/conformance/results/ty/protocols_merging.toml @@ -0,0 +1,15 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not reject attempted instantiation of abstract subclasses of protocols. +""" +errors_diff = """ +Line 82: Expected 1 errors +""" +output = """ +protocols_merging.py:52:25: error[invalid-assignment] Object of type `SCConcrete2` is not assignable to `SizedAndClosable1` +protocols_merging.py:53:25: error[invalid-assignment] Object of type `SCConcrete2` is not assignable to `SizedAndClosable2` +protocols_merging.py:54:25: error[invalid-assignment] Object of type `SCConcrete2` is not assignable to `SizedAndClosable3` +protocols_merging.py:67:16: error[invalid-protocol] Protocol class `BadProto` cannot inherit from non-protocol class `SizedAndClosable3` +protocols_merging.py:83:24: error[invalid-assignment] Object of type `SCConcrete1` is not assignable to `SizedAndClosable4` +""" diff --git a/conformance/results/ty/protocols_modules.toml b/conformance/results/ty/protocols_modules.toml new file mode 100644 index 00000000..ff470754 --- /dev/null +++ b/conformance/results/ty/protocols_modules.toml @@ -0,0 +1,16 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Never considers a module as satisfying a protocol with a method member due to the fact that the method will never exist on the class `types.ModuleType`, only on a given specific module instance. +""" +errors_diff = """ +Line 25: Unexpected errors ["protocols_modules.py:25:17: error[invalid-assignment] Object of type `` is not assignable to `Options1`"] +Line 47: Unexpected errors ["protocols_modules.py:47:18: error[invalid-assignment] Object of type `` is not assignable to `Reporter1`"] +""" +output = """ +protocols_modules.py:25:17: error[invalid-assignment] Object of type `` is not assignable to `Options1` +protocols_modules.py:26:17: error[invalid-assignment] Object of type `` is not assignable to `Options2` +protocols_modules.py:47:18: error[invalid-assignment] Object of type `` is not assignable to `Reporter1` +protocols_modules.py:48:18: error[invalid-assignment] Object of type `` is not assignable to `Reporter2` +protocols_modules.py:49:18: error[invalid-assignment] Object of type `` is not assignable to `Reporter3` +""" diff --git a/conformance/results/ty/protocols_recursive.toml b/conformance/results/ty/protocols_recursive.toml new file mode 100644 index 00000000..f6bfd787 --- /dev/null +++ b/conformance/results/ty/protocols_recursive.toml @@ -0,0 +1,11 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Fails to solve a type variable involving a recursive generic protocol. +""" +errors_diff = """ +Line 81: Unexpected errors ['protocols_recursive.py:81:1: error[type-assertion-failure] Type `Unknown` does not match asserted type `list[int]`'] +""" +output = """ +protocols_recursive.py:81:1: error[type-assertion-failure] Type `Unknown` does not match asserted type `list[int]` +""" diff --git a/conformance/results/ty/protocols_runtime_checkable.toml b/conformance/results/ty/protocols_runtime_checkable.toml new file mode 100644 index 00000000..84b9abcd --- /dev/null +++ b/conformance/results/ty/protocols_runtime_checkable.toml @@ -0,0 +1,15 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not reject `isinstance()` or `issubclass()` calls against runtime-checkable protocols where there is an unsafe overlap between the type of the first argument and the protocol. +""" +errors_diff = """ +Line 88: Expected 1 errors +Line 92: Expected 1 errors +Line 96: Expected 1 errors +""" +output = """ +protocols_runtime_checkable.py:23:8: error[isinstance-against-protocol] Class `Proto1` cannot be used as the second argument to `isinstance`: This call will raise `TypeError` at runtime +protocols_runtime_checkable.py:55:8: error[isinstance-against-protocol] `DataProtocol` cannot be used as the second argument to `issubclass` as it is a protocol with non-method members +protocols_runtime_checkable.py:61:8: error[isinstance-against-protocol] `DataProtocol` cannot be used as the second argument to `issubclass` as it is a protocol with non-method members +""" diff --git a/conformance/results/ty/protocols_self.toml b/conformance/results/ty/protocols_self.toml new file mode 100644 index 00000000..cdd4d0cd --- /dev/null +++ b/conformance/results/ty/protocols_self.toml @@ -0,0 +1,5 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +""" diff --git a/conformance/results/ty/protocols_subtyping.toml b/conformance/results/ty/protocols_subtyping.toml new file mode 100644 index 00000000..b75d7d45 --- /dev/null +++ b/conformance/results/ty/protocols_subtyping.toml @@ -0,0 +1,12 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +protocols_subtyping.py:16:6: error[call-non-callable] Cannot instantiate class `Proto1`: This call will raise `TypeError` at runtime +protocols_subtyping.py:38:21: error[invalid-assignment] Object of type `Proto2` is not assignable to `Concrete2` +protocols_subtyping.py:55:18: error[invalid-assignment] Object of type `Proto2` is not assignable to `Proto3` +protocols_subtyping.py:79:30: error[invalid-assignment] Object of type `Proto5[int]` is not assignable to `Proto4[int, int | float]` +protocols_subtyping.py:80:25: error[invalid-assignment] Object of type `Proto4[int, int]` is not assignable to `Proto5[int | float]` +protocols_subtyping.py:102:30: error[invalid-assignment] Object of type `Proto6[int | float, int | float]` is not assignable to `Proto7[int, int | float]` +protocols_subtyping.py:103:33: error[invalid-assignment] Object of type `Proto6[int | float, int | float]` is not assignable to `Proto7[int | float, object]` +""" diff --git a/conformance/results/ty/protocols_variance.toml b/conformance/results/ty/protocols_variance.toml new file mode 100644 index 00000000..303056e9 --- /dev/null +++ b/conformance/results/ty/protocols_variance.toml @@ -0,0 +1,13 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 21: Expected 1 errors +Line 40: Expected 1 errors +Line 56: Expected 1 errors +Line 66: Expected 1 errors +Line 104: Expected 1 errors +Lines 61, 62: Expected error (tag 'covariant_in_input') +Lines 71, 72: Expected error (tag 'contravariant_in_output') +""" +output = """ +""" diff --git a/conformance/results/ty/qualifiers_annotated.toml b/conformance/results/ty/qualifiers_annotated.toml new file mode 100644 index 00000000..da1de796 --- /dev/null +++ b/conformance/results/ty/qualifiers_annotated.toml @@ -0,0 +1,27 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +qualifiers_annotated.py:38:17: error[invalid-type-form] List literals are not allowed in this context in a type expression: Did you mean `tuple[int, str]`? +qualifiers_annotated.py:39:17: error[invalid-type-form] Tuple literals are not allowed in this context in a type expression +qualifiers_annotated.py:39:18: error[invalid-type-form] Tuple literals are not allowed in this context in a type expression: Did you mean `tuple[int, str]`? +qualifiers_annotated.py:40:17: error[invalid-type-form] List comprehensions are not allowed in type expressions +qualifiers_annotated.py:41:17: error[invalid-type-form] Dict literals are not allowed in type expressions +qualifiers_annotated.py:42:17: error[invalid-type-form] Function calls are not allowed in type expressions +qualifiers_annotated.py:43:17: error[invalid-type-form] Invalid subscript of object of type `list[]` in type expression +qualifiers_annotated.py:43:23: error[invalid-type-form] Int literals are not allowed in this context in a type expression +qualifiers_annotated.py:44:17: error[invalid-type-form] `if` expressions are not allowed in type expressions +qualifiers_annotated.py:45:17: error[unresolved-reference] Name `var1` used when not defined +qualifiers_annotated.py:46:17: error[invalid-type-form] Boolean literals are not allowed in this context in a type expression +qualifiers_annotated.py:47:18: error[invalid-type-form] Int literals are not allowed in this context in a type expression +qualifiers_annotated.py:48:18: error[invalid-type-form] Boolean operations are not allowed in type expressions +qualifiers_annotated.py:49:18: error[fstring-type-annotation] Type expressions cannot use f-strings +qualifiers_annotated.py:59:8: error[invalid-type-form] Special form `typing.Annotated` expected at least 2 arguments (one type and at least one metadata element) +qualifiers_annotated.py:71:24: error[invalid-assignment] Object of type `]'>` is not assignable to `type[Any]` +qualifiers_annotated.py:72:24: error[invalid-assignment] Object of type `]'>` is not assignable to `type[Any]` +qualifiers_annotated.py:79:7: error[invalid-argument-type] Argument to function `func4` is incorrect: Expected `type[Unknown]`, found `]'>` +qualifiers_annotated.py:80:7: error[invalid-argument-type] Argument to function `func4` is incorrect: Expected `type[Unknown]`, found `]'>` +qualifiers_annotated.py:86:1: error[call-non-callable] Object of type `` is not callable +qualifiers_annotated.py:87:1: error[call-non-callable] Object of type `GenericAlias` is not callable +qualifiers_annotated.py:88:1: error[call-non-callable] Object of type `GenericAlias` is not callable +""" diff --git a/conformance/results/ty/qualifiers_final_annotation.toml b/conformance/results/ty/qualifiers_final_annotation.toml new file mode 100644 index 00000000..82b09cbe --- /dev/null +++ b/conformance/results/ty/qualifiers_final_annotation.toml @@ -0,0 +1,38 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not forbid `Final`-annotated assignments to attributes on `self` in non-`__init__` methods. +Does not flag modifications of `Final`-annotated attributes via augmented assignment. +""" +errors_diff = """ +Line 62: Expected 1 errors +Line 63: Expected 1 errors +Line 67: Expected 1 errors +""" +output = """ +qualifiers_final_annotation.py:16:1: error[final-without-value] `Final` symbol `BAD1` is not assigned a value +qualifiers_final_annotation.py:18:7: error[invalid-type-form] Type qualifier `typing.Final` expected exactly 1 argument, got 2 +qualifiers_final_annotation.py:34:5: error[final-without-value] `Final` symbol `ID2` is not assigned a value +qualifiers_final_annotation.py:38:5: error[final-without-value] `Final` symbol `ID3` is not assigned a value +qualifiers_final_annotation.py:54:9: error[invalid-assignment] Cannot assign to final attribute `ID5` in `__init__` because it already has a value at class level +qualifiers_final_annotation.py:65:9: error[invalid-assignment] Cannot assign to final attribute `ID7` on type `Self@method1` +qualifiers_final_annotation.py:71:1: error[invalid-assignment] Reassignment of `Final` symbol `RATE` is not allowed: Symbol later reassigned here +qualifiers_final_annotation.py:81:1: error[invalid-assignment] Cannot assign to final attribute `DEFAULT_ID` on type `` +qualifiers_final_annotation.py:94:5: error[override-of-final-variable] Cannot override final variable `BORDER_WIDTH` from superclass `ClassC` +qualifiers_final_annotation.py:107:13: error[redundant-final-classvar] `Combining `ClassVar` and `Final` is redundant +qualifiers_final_annotation.py:108:13: error[redundant-final-classvar] `Combining `ClassVar` and `Final` is redundant +qualifiers_final_annotation.py:118:9: error[invalid-type-form] Type qualifier `typing.Final` is not allowed in type expressions (only in annotation expressions) +qualifiers_final_annotation.py:121:11: error[invalid-type-form] `Final` is not allowed in function parameter annotations +qualifiers_final_annotation.py:134:1: error[missing-argument] No arguments provided for required parameters `x`, `y` +qualifiers_final_annotation.py:134:3: error[unknown-argument] Argument `a` does not match any known parameter +qualifiers_final_annotation.py:135:3: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal[""]` +qualifiers_final_annotation.py:135:9: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Literal[""]` +qualifiers_final_annotation.py:141:5: error[invalid-assignment] Reassignment of `Final` symbol `ID1` is not allowed: Reassignment of `Final` symbol +qualifiers_final_annotation.py:145:5: error[invalid-assignment] Reassignment of `Final` symbol `x` is not allowed: Symbol later reassigned here +qualifiers_final_annotation.py:147:10: error[invalid-assignment] Reassignment of `Final` symbol `x` is not allowed: Symbol later reassigned here +qualifiers_final_annotation.py:149:9: error[invalid-assignment] Reassignment of `Final` symbol `x` is not allowed: Symbol later reassigned here +qualifiers_final_annotation.py:152:30: error[invalid-assignment] Reassignment of `Final` symbol `x` is not allowed: Symbol later reassigned here +qualifiers_final_annotation.py:155:9: error[invalid-assignment] Reassignment of `Final` symbol `x` is not allowed: Symbol later reassigned here +qualifiers_final_annotation.py:166:1: error[invalid-assignment] Reassignment of `Final` symbol `TEN` is not allowed: Reassignment of `Final` symbol +qualifiers_final_annotation.py:170:1: error[invalid-assignment] Reassignment of `Final` symbol `PI` is not allowed: Reassignment of `Final` symbol +""" diff --git a/conformance/results/ty/qualifiers_final_decorator.toml b/conformance/results/ty/qualifiers_final_decorator.toml new file mode 100644 index 00000000..7236dc2a --- /dev/null +++ b/conformance/results/ty/qualifiers_final_decorator.toml @@ -0,0 +1,16 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +qualifiers_final_decorator.py:21:16: error[subclass-of-final-class] Class `Derived1` cannot inherit from final class `Base1` +qualifiers_final_decorator.py:56:9: error[override-of-final-method] Cannot override final member `method1` from superclass `Base2` +qualifiers_final_decorator.py:60:9: error[override-of-final-method] Cannot override final member `method2` from superclass `Base2` +qualifiers_final_decorator.py:64:9: error[override-of-final-method] Cannot override final member `method3` from superclass `Base2` +qualifiers_final_decorator.py:75:9: error[override-of-final-method] Cannot override final member `method4` from superclass `Base2` +qualifiers_final_decorator.py:86:9: error[invalid-overload] `@final` decorator should be applied only to the overload implementation +qualifiers_final_decorator.py:89:9: error[override-of-final-method] Cannot override final member `method` from superclass `Base3` +qualifiers_final_decorator.py:102:9: error[override-of-final-method] Cannot override final member `method` from superclass `Base4` +qualifiers_final_decorator.py:118:9: error[invalid-method-override] Invalid override of method `method`: Definition is incompatible with `Base5_2.method` +qualifiers_final_decorator.py:118:9: error[override-of-final-method] Cannot override final member `method` from superclass `Base5_2` +qualifiers_final_decorator.py:125:1: error[final-on-non-method] `@final` cannot be applied to non-method function `func1` +""" diff --git a/conformance/results/ty/specialtypes_any.toml b/conformance/results/ty/specialtypes_any.toml new file mode 100644 index 00000000..cdd4d0cd --- /dev/null +++ b/conformance/results/ty/specialtypes_any.toml @@ -0,0 +1,5 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +""" diff --git a/conformance/results/ty/specialtypes_never.toml b/conformance/results/ty/specialtypes_never.toml new file mode 100644 index 00000000..9f528bb4 --- /dev/null +++ b/conformance/results/ty/specialtypes_never.toml @@ -0,0 +1,8 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +specialtypes_never.py:19:22: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `Never` +specialtypes_never.py:85:21: error[invalid-assignment] Object of type `list[Never]` is not assignable to `list[int]` +specialtypes_never.py:104:12: error[invalid-return-type] Return type does not match returned value: expected `ClassC[U@func10]`, found `ClassC[Never]` +""" diff --git a/conformance/results/ty/specialtypes_none.toml b/conformance/results/ty/specialtypes_none.toml new file mode 100644 index 00000000..9801c5cc --- /dev/null +++ b/conformance/results/ty/specialtypes_none.toml @@ -0,0 +1,8 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +specialtypes_none.py:21:7: error[invalid-argument-type] Argument to function `func1` is incorrect: Expected `None`, found `` +specialtypes_none.py:27:19: error[invalid-assignment] Object of type `None` is not assignable to `Iterable[Unknown]` +specialtypes_none.py:41:7: error[invalid-argument-type] Argument to function `func2` is incorrect: Expected ``, found `None` +""" diff --git a/conformance/results/ty/specialtypes_promotions.toml b/conformance/results/ty/specialtypes_promotions.toml new file mode 100644 index 00000000..5dea49f8 --- /dev/null +++ b/conformance/results/ty/specialtypes_promotions.toml @@ -0,0 +1,6 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +specialtypes_promotions.py:13:5: error[unresolved-attribute] Attribute `numerator` is not defined on `float` in union `int | float` +""" diff --git a/conformance/results/ty/specialtypes_type.toml b/conformance/results/ty/specialtypes_type.toml new file mode 100644 index 00000000..20b222ad --- /dev/null +++ b/conformance/results/ty/specialtypes_type.toml @@ -0,0 +1,37 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Allows arbitrary attributes to be accessed on `TA` where `TA = typing.Type[typing.Any]` or `TA = type[typing.Any]`. +Treats `type` equivalently to `type[object]` rather than `type[typing.Any]`. +""" +errors_diff = """ +Line 144: Expected 1 errors +Line 146: Expected 1 errors +Line 84: Unexpected errors ['specialtypes_type.py:84:5: error[type-assertion-failure] Type `type` does not match asserted type `type[Any]`'] +Line 99: Unexpected errors ['specialtypes_type.py:99:17: error[unresolved-attribute] Object of type `type` has no attribute `unknown`'] +Line 100: Unexpected errors ['specialtypes_type.py:100:17: error[unresolved-attribute] Object of type `type` has no attribute `unknown`'] +Line 107: Unexpected errors ['specialtypes_type.py:107:17: error[unresolved-attribute] Object of type `type` has no attribute `unknown`'] +Line 108: Unexpected errors ['specialtypes_type.py:108:17: error[unresolved-attribute] Object of type `type` has no attribute `unknown`'] +Line 137: Unexpected errors ['specialtypes_type.py:137:5: error[type-assertion-failure] Type `type` does not match asserted type `type[Any]`'] +Line 139: Unexpected errors ['specialtypes_type.py:139:5: error[type-assertion-failure] Type `type` does not match asserted type `type[Any]`'] +Line 169: Unexpected errors ['specialtypes_type.py:169:21: error[invalid-assignment] Object of type `type` is not assignable to `type[int]`'] +Line 175: Unexpected errors ['specialtypes_type.py:175:16: error[invalid-return-type] Return type does not match returned value: expected `type[T@ClassA]`, found `type`'] +""" +output = """ +specialtypes_type.py:56:7: error[invalid-argument-type] Argument to function `func4` is incorrect: Expected `type[BasicUser | ProUser]`, found `` +specialtypes_type.py:70:7: error[invalid-argument-type] Argument to function `func5` is incorrect: Expected `type[Unknown]`, found `` +specialtypes_type.py:76:17: error[invalid-type-form] type[...] must have exactly one type argument +specialtypes_type.py:84:5: error[type-assertion-failure] Type `type` does not match asserted type `type[Any]` +specialtypes_type.py:99:17: error[unresolved-attribute] Object of type `type` has no attribute `unknown` +specialtypes_type.py:100:17: error[unresolved-attribute] Object of type `type` has no attribute `unknown` +specialtypes_type.py:107:17: error[unresolved-attribute] Object of type `type` has no attribute `unknown` +specialtypes_type.py:108:17: error[unresolved-attribute] Object of type `type` has no attribute `unknown` +specialtypes_type.py:117:5: error[unresolved-attribute] Object of type `type` has no attribute `unknown` +specialtypes_type.py:120:5: error[unresolved-attribute] Object of type `type` has no attribute `unknown` +specialtypes_type.py:137:5: error[type-assertion-failure] Type `type` does not match asserted type `type[Any]` +specialtypes_type.py:139:5: error[type-assertion-failure] Type `type` does not match asserted type `type[Any]` +specialtypes_type.py:143:1: error[unresolved-attribute] Special form `typing.Type` has no attribute `unknown` +specialtypes_type.py:145:1: error[unresolved-attribute] Class `type` has no attribute `unknown` +specialtypes_type.py:169:21: error[invalid-assignment] Object of type `type` is not assignable to `type[int]` +specialtypes_type.py:175:16: error[invalid-return-type] Return type does not match returned value: expected `type[T@ClassA]`, found `type` +""" diff --git a/conformance/results/ty/tuples_type_compat.toml b/conformance/results/ty/tuples_type_compat.toml new file mode 100644 index 00000000..e908be4b --- /dev/null +++ b/conformance/results/ty/tuples_type_compat.toml @@ -0,0 +1,29 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +tuples_type_compat.py:15:27: error[invalid-assignment] Object of type `tuple[int | float, int | float | complex]` is not assignable to `tuple[int, int]` +tuples_type_compat.py:29:10: error[invalid-assignment] Object of type `tuple[int, ...]` is not assignable to `tuple[int, *tuple[int, ...]]` +tuples_type_compat.py:32:10: error[invalid-assignment] Object of type `tuple[int, *tuple[int, ...]]` is not assignable to `tuple[int]` +tuples_type_compat.py:33:10: error[invalid-assignment] Object of type `tuple[int, ...]` is not assignable to `tuple[int]` +tuples_type_compat.py:43:22: error[invalid-assignment] Object of type `tuple[int, ...]` is not assignable to `tuple[int]` +tuples_type_compat.py:62:26: error[invalid-assignment] Object of type `tuple[int, ...]` is not assignable to `tuple[int, int]` +tuples_type_compat.py:75:9: error[type-assertion-failure] Type `tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]` does not match asserted type `tuple[int]` +tuples_type_compat.py:80:9: error[type-assertion-failure] Type `tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]` does not match asserted type `tuple[str, str] | tuple[int, int]` +tuples_type_compat.py:85:9: error[type-assertion-failure] Type `tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]` does not match asserted type `tuple[int, str, int]` +tuples_type_compat.py:101:13: error[type-assertion-failure] Type `tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]` does not match asserted type `tuple[int]` +tuples_type_compat.py:106:13: error[type-assertion-failure] Type `tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]` does not match asserted type `tuple[str, str] | tuple[int, int]` +tuples_type_compat.py:111:13: error[type-assertion-failure] Type `tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int]` does not match asserted type `tuple[int, str, int]` +tuples_type_compat.py:126:13: error[type-assertion-failure] Type `tuple[int | str, int | str]` does not match asserted type `tuple[int | str, str]` +tuples_type_compat.py:129:13: error[type-assertion-failure] Type `tuple[int | str, int | str]` does not match asserted type `tuple[int | str, int]` +tuples_type_compat.py:157:6: error[invalid-assignment] Object of type `tuple[Literal[1], Literal[""], Literal[""]]` is not assignable to `tuple[int, str]` +tuples_type_compat.py:162:6: error[invalid-assignment] Object of type `tuple[Literal[1], Literal[1], Literal[""]]` is not assignable to `tuple[int, *tuple[str, ...]]` +tuples_type_compat.py:163:6: error[invalid-assignment] Object of type `tuple[Literal[1], Literal[""], Literal[1]]` is not assignable to `tuple[int, *tuple[str, ...]]` +tuples_type_compat.py:169:6: error[invalid-assignment] Object of type `tuple[Literal[1], Literal[""], Literal[""]]` is not assignable to `tuple[int, *tuple[str, ...], int]` +tuples_type_compat.py:170:6: error[invalid-assignment] Object of type `tuple[Literal[1], Literal[""], Literal[""], float]` is not assignable to `tuple[int, *tuple[str, ...], int]` +tuples_type_compat.py:175:6: error[invalid-assignment] Object of type `tuple[Literal[1], Literal[""], Literal[1]]` is not assignable to `tuple[*tuple[str, ...], int]` +tuples_type_compat.py:176:6: error[invalid-assignment] Object of type `tuple[Literal[""], Literal[""], float]` is not assignable to `tuple[*tuple[str, ...], int]` +tuples_type_compat.py:181:40: error[invalid-assignment] Object of type `tuple[str, str]` is not assignable to `tuple[str, str, int]` +tuples_type_compat.py:184:50: error[invalid-assignment] Object of type `tuple[str, str]` is not assignable to `tuple[str, str, str, *tuple[str, ...]]` +tuples_type_compat.py:188:50: error[invalid-assignment] Object of type `tuple[str, str]` is not assignable to `tuple[*tuple[str, ...], str, str, str]` +""" diff --git a/conformance/results/ty/tuples_type_form.toml b/conformance/results/ty/tuples_type_form.toml new file mode 100644 index 00000000..1a50c81a --- /dev/null +++ b/conformance/results/ty/tuples_type_form.toml @@ -0,0 +1,16 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +tuples_type_form.py:12:6: error[invalid-assignment] Object of type `tuple[Literal[1], Literal[2]]` is not assignable to `tuple[int]` +tuples_type_form.py:14:6: error[invalid-assignment] Object of type `tuple[Literal[1]]` is not assignable to `tuple[int, int]` +tuples_type_form.py:15:6: error[invalid-assignment] Object of type `tuple[Literal[1], Literal[""]]` is not assignable to `tuple[int, int]` +tuples_type_form.py:25:7: error[invalid-assignment] Object of type `tuple[Literal[1]]` is not assignable to `tuple[()]` +tuples_type_form.py:36:7: error[invalid-assignment] Object of type `tuple[Literal[1], Literal[2], Literal[3], Literal[""]]` is not assignable to `tuple[int, ...]` +tuples_type_form.py:40:6: error[invalid-type-form] Invalid `tuple` specialization: `...` can only be used as the second element in a two-element `tuple` specialization +tuples_type_form.py:41:6: error[invalid-type-form] Invalid `tuple` specialization: `...` can only be used as the second element in a two-element `tuple` specialization +tuples_type_form.py:42:6: error[invalid-type-form] Invalid `tuple` specialization: `...` can only be used as the second element in a two-element `tuple` specialization +tuples_type_form.py:43:6: error[invalid-type-form] Invalid `tuple` specialization: `...` can only be used as the second element in a two-element `tuple` specialization +tuples_type_form.py:44:6: error[invalid-type-form] Invalid `tuple` specialization: `...` cannot be used after an unpacked element +tuples_type_form.py:45:6: error[invalid-type-form] Invalid `tuple` specialization: `...` cannot be used after an unpacked element +""" diff --git a/conformance/results/ty/tuples_unpacked.toml b/conformance/results/ty/tuples_unpacked.toml new file mode 100644 index 00000000..b45a4fd3 --- /dev/null +++ b/conformance/results/ty/tuples_unpacked.toml @@ -0,0 +1,10 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +tuples_unpacked.py:40:5: error[invalid-type-form] Multiple unpacked variadic tuples are not allowed in a `tuple` specialization +tuples_unpacked.py:41:5: error[invalid-type-form] Multiple unpacked variadic tuples are not allowed in a `tuple` specialization +tuples_unpacked.py:51:9: error[invalid-type-form] Multiple unpacked variadic tuples are not allowed in a `tuple` specialization +tuples_unpacked.py:59:6: error[invalid-type-form] Multiple unpacked variadic tuples are not allowed in a `tuple` specialization +tuples_unpacked.py:60:6: error[invalid-type-form] Multiple unpacked variadic tuples are not allowed in a `tuple` specialization +""" diff --git a/conformance/results/ty/typeddicts_alt_syntax.toml b/conformance/results/ty/typeddicts_alt_syntax.toml new file mode 100644 index 00000000..31db9e35 --- /dev/null +++ b/conformance/results/ty/typeddicts_alt_syntax.toml @@ -0,0 +1,10 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 23: Expected 1 errors +Line 27: Expected 1 errors +Line 31: Expected 1 errors +Line 35: Expected 1 errors +""" +output = """ +""" diff --git a/conformance/results/ty/typeddicts_class_syntax.toml b/conformance/results/ty/typeddicts_class_syntax.toml new file mode 100644 index 00000000..691787e7 --- /dev/null +++ b/conformance/results/ty/typeddicts_class_syntax.toml @@ -0,0 +1,10 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +typeddicts_class_syntax.py:29:5: error[invalid-typed-dict-statement] TypedDict class cannot have methods +typeddicts_class_syntax.py:33:5: error[invalid-typed-dict-statement] TypedDict class cannot have methods +typeddicts_class_syntax.py:38:5: error[invalid-typed-dict-statement] TypedDict class cannot have methods +typeddicts_class_syntax.py:44:32: error[invalid-typed-dict-header] Custom metaclasses are not supported in `TypedDict` definitions +typeddicts_class_syntax.py:49:32: error[unknown-argument] Unknown keyword argument `other` in `TypedDict` definition +""" diff --git a/conformance/results/ty/typeddicts_extra_items.toml b/conformance/results/ty/typeddicts_extra_items.toml new file mode 100644 index 00000000..989146a4 --- /dev/null +++ b/conformance/results/ty/typeddicts_extra_items.toml @@ -0,0 +1,78 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 22: Expected 1 errors +Line 49: Expected 1 errors +Line 67: Expected 1 errors +Line 73: Expected 1 errors +Line 109: Expected 1 errors +Line 114: Expected 1 errors +Line 117: Expected 1 errors +Line 143: Expected 1 errors +Line 174: Expected 1 errors +Line 215: Expected 1 errors +Line 222: Expected 1 errors +Line 242: Expected 1 errors +Line 256: Expected 1 errors +Line 257: Expected 1 errors +Line 268: Expected 1 errors +Lines 91, 92: Expected error (tag 'MovieC') +Lines 94, 95: Expected error (tag 'MovieD') +Lines 184, 185: Expected error (tag 'MovieRequiredYear') +Lines 187, 188: Expected error (tag 'MovieNotRequiredYear') +Lines 196, 197: Expected error (tag 'BookWithPublisher') +Line 14: Unexpected errors ['typeddicts_extra_items.py:14:37: error[invalid-key] Unknown key "novel_adaptation" for TypedDict `Movie`: Unknown key "novel_adaptation"'] +Line 29: Unexpected errors ['typeddicts_extra_items.py:29:5: error[type-assertion-failure] Type `str` does not match asserted type `bool`', 'typeddicts_extra_items.py:29:23: error[invalid-key] Unknown key "novel_adaptation" for TypedDict `Movie`: Unknown key "novel_adaptation"'] +Line 43: Unexpected errors ['typeddicts_extra_items.py:43:5: error[invalid-key] Unknown key "other_extra_key" for TypedDict `InheritedMovie`: Unknown key "other_extra_key"'] +Line 129: Unexpected errors ['typeddicts_extra_items.py:129:15: error[invalid-argument-type] Cannot delete unknown key "year" from TypedDict `MovieEI`'] +Line 254: Unexpected errors ['typeddicts_extra_items.py:254:63: error[invalid-key] Unknown key "year" for TypedDict `MovieExtraInt`: Unknown key "year"'] +Line 255: Unexpected errors ['typeddicts_extra_items.py:255:63: error[invalid-key] Unknown key "description" for TypedDict `MovieExtraStr`: Unknown key "description"'] +Line 266: Unexpected errors ['typeddicts_extra_items.py:266:64: error[invalid-key] Unknown key "year" for TypedDict `MovieExtraInt`: Unknown key "year"'] +Line 284: Unexpected errors ['typeddicts_extra_items.py:284:43: error[invalid-key] Unknown key "year" for TypedDict `ExtraMovie`: Unknown key "year"'] +Line 299: Unexpected errors ['typeddicts_extra_items.py:299:54: error[invalid-key] Unknown key "summary" for TypedDict `MovieExtraStr`: Unknown key "summary"'] +Line 300: Unexpected errors ['typeddicts_extra_items.py:300:34: error[invalid-assignment] Object of type `MovieExtraStr` is not assignable to `Mapping[str, str]`'] +Line 302: Unexpected errors ['typeddicts_extra_items.py:302:54: error[invalid-key] Unknown key "year" for TypedDict `MovieExtraInt`: Unknown key "year"'] +Line 304: Unexpected errors ['typeddicts_extra_items.py:304:44: error[invalid-assignment] Object of type `MovieExtraInt` is not assignable to `Mapping[str, int | str]`'] +Line 310: Unexpected errors ['typeddicts_extra_items.py:310:5: error[type-assertion-failure] Type `list[tuple[str, object]]` does not match asserted type `list[tuple[str, int | str]]`'] +Line 311: Unexpected errors ['typeddicts_extra_items.py:311:5: error[type-assertion-failure] Type `list[object]` does not match asserted type `list[int | str]`'] +Line 326: Unexpected errors ['typeddicts_extra_items.py:326:25: error[invalid-assignment] Object of type `IntDict` is not assignable to `dict[str, int]`'] +Line 329: Unexpected errors ['typeddicts_extra_items.py:329:52: error[invalid-key] Unknown key "bar" for TypedDict `IntDictWithNum`: Unknown key "bar"'] +Line 330: Unexpected errors ['typeddicts_extra_items.py:330:32: error[invalid-assignment] Object of type `IntDictWithNum` is not assignable to `dict[str, int]`'] +Line 337: Unexpected errors ['typeddicts_extra_items.py:337:1: error[unresolved-attribute] Object of type `IntDictWithNum` has no attribute `clear`'] +Line 339: Unexpected errors ['typeddicts_extra_items.py:339:1: error[type-assertion-failure] Type `Unknown` does not match asserted type `tuple[str, int]`', 'typeddicts_extra_items.py:339:13: error[unresolved-attribute] Object of type `IntDictWithNum` has no attribute `popitem`'] +Line 342: Unexpected errors ['typeddicts_extra_items.py:342:27: error[invalid-key] TypedDict `IntDictWithNum` can only be subscripted with a string literal key, got key of type `str`.'] +Line 343: Unexpected errors ['typeddicts_extra_items.py:343:9: error[invalid-argument-type] Method `__delitem__` of type `(key: Literal["num"], /) -> None` cannot be called with key of type `str` on object of type `IntDictWithNum`'] +""" +output = """ +typeddicts_extra_items.py:14:37: error[invalid-key] Unknown key "novel_adaptation" for TypedDict `Movie`: Unknown key "novel_adaptation" +typeddicts_extra_items.py:15:37: error[invalid-key] Unknown key "year" for TypedDict `Movie`: Unknown key "year" +typeddicts_extra_items.py:29:5: error[type-assertion-failure] Type `str` does not match asserted type `bool` +typeddicts_extra_items.py:29:23: error[invalid-key] Unknown key "novel_adaptation" for TypedDict `Movie`: Unknown key "novel_adaptation" +typeddicts_extra_items.py:39:54: error[invalid-argument-type] Invalid argument to key "year" with declared type `int` on TypedDict `InheritedMovie`: value of type `None` +typeddicts_extra_items.py:43:5: error[invalid-key] Unknown key "other_extra_key" for TypedDict `InheritedMovie`: Unknown key "other_extra_key" +typeddicts_extra_items.py:128:15: error[invalid-argument-type] Cannot delete required key "name" from TypedDict `MovieEI` +typeddicts_extra_items.py:129:15: error[invalid-argument-type] Cannot delete unknown key "year" from TypedDict `MovieEI` +typeddicts_extra_items.py:254:63: error[invalid-key] Unknown key "year" for TypedDict `MovieExtraInt`: Unknown key "year" +typeddicts_extra_items.py:255:63: error[invalid-key] Unknown key "description" for TypedDict `MovieExtraStr`: Unknown key "description" +typeddicts_extra_items.py:266:64: error[invalid-key] Unknown key "year" for TypedDict `MovieExtraInt`: Unknown key "year" +typeddicts_extra_items.py:278:47: error[invalid-key] Unknown key "year" for TypedDict `NonClosedMovie`: Unknown key "year" +typeddicts_extra_items.py:284:43: error[invalid-key] Unknown key "year" for TypedDict `ExtraMovie`: Unknown key "year" +typeddicts_extra_items.py:285:43: error[invalid-key] Unknown key "language" for TypedDict `ExtraMovie`: Unknown key "language" +typeddicts_extra_items.py:293:44: error[invalid-key] Unknown key "year" for TypedDict `ClosedMovie`: Unknown key "year" +typeddicts_extra_items.py:299:54: error[invalid-key] Unknown key "summary" for TypedDict `MovieExtraStr`: Unknown key "summary" +typeddicts_extra_items.py:300:34: error[invalid-assignment] Object of type `MovieExtraStr` is not assignable to `Mapping[str, str]` +typeddicts_extra_items.py:302:54: error[invalid-key] Unknown key "year" for TypedDict `MovieExtraInt`: Unknown key "year" +typeddicts_extra_items.py:303:34: error[invalid-assignment] Object of type `MovieExtraInt` is not assignable to `Mapping[str, int]` +typeddicts_extra_items.py:304:44: error[invalid-assignment] Object of type `MovieExtraInt` is not assignable to `Mapping[str, int | str]` +typeddicts_extra_items.py:310:5: error[type-assertion-failure] Type `list[tuple[str, object]]` does not match asserted type `list[tuple[str, int | str]]` +typeddicts_extra_items.py:311:5: error[type-assertion-failure] Type `list[object]` does not match asserted type `list[int | str]` +typeddicts_extra_items.py:326:25: error[invalid-assignment] Object of type `IntDict` is not assignable to `dict[str, int]` +typeddicts_extra_items.py:329:52: error[invalid-key] Unknown key "bar" for TypedDict `IntDictWithNum`: Unknown key "bar" +typeddicts_extra_items.py:330:32: error[invalid-assignment] Object of type `IntDictWithNum` is not assignable to `dict[str, int]` +typeddicts_extra_items.py:337:1: error[unresolved-attribute] Object of type `IntDictWithNum` has no attribute `clear` +typeddicts_extra_items.py:339:1: error[type-assertion-failure] Type `Unknown` does not match asserted type `tuple[str, int]` +typeddicts_extra_items.py:339:13: error[unresolved-attribute] Object of type `IntDictWithNum` has no attribute `popitem` +typeddicts_extra_items.py:342:27: error[invalid-key] TypedDict `IntDictWithNum` can only be subscripted with a string literal key, got key of type `str`. +typeddicts_extra_items.py:343:9: error[invalid-argument-type] Method `__delitem__` of type `(key: Literal["num"], /) -> None` cannot be called with key of type `str` on object of type `IntDictWithNum` +typeddicts_extra_items.py:352:25: error[invalid-assignment] Object of type `dict[str, int]` is not assignable to `IntDict` +""" diff --git a/conformance/results/ty/typeddicts_final.toml b/conformance/results/ty/typeddicts_final.toml new file mode 100644 index 00000000..cdd4d0cd --- /dev/null +++ b/conformance/results/ty/typeddicts_final.toml @@ -0,0 +1,5 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +""" diff --git a/conformance/results/ty/typeddicts_inheritance.toml b/conformance/results/ty/typeddicts_inheritance.toml new file mode 100644 index 00000000..4a5bd74e --- /dev/null +++ b/conformance/results/ty/typeddicts_inheritance.toml @@ -0,0 +1,12 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not validate overrides of `TypedDict` fields in subclasses. +""" +errors_diff = """ +Line 65: Expected 1 errors +Lines 54, 55: Expected error (tag 'Y1') +""" +output = """ +typeddicts_inheritance.py:44:31: error[invalid-typed-dict-header] TypedDict class `BadTypedDict` can only inherit from TypedDict classes: `NonTypedDict` is not a `TypedDict` class +""" diff --git a/conformance/results/ty/typeddicts_operations.toml b/conformance/results/ty/typeddicts_operations.toml new file mode 100644 index 00000000..80d83117 --- /dev/null +++ b/conformance/results/ty/typeddicts_operations.toml @@ -0,0 +1,16 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +typeddicts_operations.py:22:17: error[invalid-assignment] Invalid assignment to key "name" with declared type `str` on TypedDict `Movie`: value of type `Literal[1982]` +typeddicts_operations.py:23:17: error[invalid-assignment] Invalid assignment to key "year" with declared type `int` on TypedDict `Movie`: value of type `Literal[""]` +typeddicts_operations.py:24:7: error[invalid-key] Unknown key "other" for TypedDict `Movie`: Unknown key "other" +typeddicts_operations.py:26:13: error[invalid-key] Unknown key "other" for TypedDict `Movie`: Unknown key "other" +typeddicts_operations.py:28:9: error[missing-typed-dict-key] Missing required key 'year' in TypedDict `Movie` constructor +typeddicts_operations.py:29:42: error[invalid-argument-type] Invalid argument to key "year" with declared type `int` on TypedDict `Movie`: value of type `float` +typeddicts_operations.py:32:36: error[invalid-key] Unknown key "other" for TypedDict `Movie`: Unknown key "other" +typeddicts_operations.py:37:20: error[missing-typed-dict-key] Missing required key 'name' in TypedDict `Movie` constructor +typeddicts_operations.py:47:1: error[unresolved-attribute] Object of type `Movie` has no attribute `clear` +typeddicts_operations.py:49:11: error[invalid-argument-type] Cannot delete required key "name" from TypedDict `Movie` +typeddicts_operations.py:62:1: error[unresolved-attribute] Object of type `MovieOptional` has no attribute `clear` +""" diff --git a/conformance/results/ty/typeddicts_readonly.toml b/conformance/results/ty/typeddicts_readonly.toml new file mode 100644 index 00000000..4fbd4fd0 --- /dev/null +++ b/conformance/results/ty/typeddicts_readonly.toml @@ -0,0 +1,15 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Supports `ReadOnly`, but not the functional syntax for `TypedDict`s currently, leading to one assertion failing. +""" +errors_diff = """ +Line 36: Expected 1 errors +""" +output = """ +typeddicts_readonly.py:24:4: error[invalid-assignment] Cannot assign to key "members" on TypedDict `Band`: key is marked read-only +typeddicts_readonly.py:50:4: error[invalid-assignment] Cannot assign to key "title" on TypedDict `Movie1`: key is marked read-only +typeddicts_readonly.py:51:4: error[invalid-assignment] Cannot assign to key "year" on TypedDict `Movie1`: key is marked read-only +typeddicts_readonly.py:60:4: error[invalid-assignment] Cannot assign to key "title" on TypedDict `Movie2`: key is marked read-only +typeddicts_readonly.py:61:4: error[invalid-assignment] Cannot assign to key "year" on TypedDict `Movie2`: key is marked read-only +""" diff --git a/conformance/results/ty/typeddicts_readonly_consistency.toml b/conformance/results/ty/typeddicts_readonly_consistency.toml new file mode 100644 index 00000000..b289d22e --- /dev/null +++ b/conformance/results/ty/typeddicts_readonly_consistency.toml @@ -0,0 +1,12 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +typeddicts_readonly_consistency.py:37:14: error[invalid-assignment] Object of type `A1` is not assignable to `B1` +typeddicts_readonly_consistency.py:38:14: error[invalid-assignment] Object of type `C1` is not assignable to `B1` +typeddicts_readonly_consistency.py:40:14: error[invalid-assignment] Object of type `A1` is not assignable to `C1` +typeddicts_readonly_consistency.py:81:14: error[invalid-assignment] Object of type `A2` is not assignable to `B2` +typeddicts_readonly_consistency.py:82:14: error[invalid-assignment] Object of type `C2` is not assignable to `B2` +typeddicts_readonly_consistency.py:84:14: error[invalid-assignment] Object of type `A2` is not assignable to `C2` +typeddicts_readonly_consistency.py:85:14: error[invalid-assignment] Object of type `B2` is not assignable to `C2` +""" diff --git a/conformance/results/ty/typeddicts_readonly_inheritance.toml b/conformance/results/ty/typeddicts_readonly_inheritance.toml new file mode 100644 index 00000000..7b60a170 --- /dev/null +++ b/conformance/results/ty/typeddicts_readonly_inheritance.toml @@ -0,0 +1,20 @@ +conformance_automated = "Fail" +conformant = "Partial" +notes = """ +Does not validate overrides of `TypedDict` keys. +""" +errors_diff = """ +Line 50: Expected 1 errors +Line 94: Expected 1 errors +Line 98: Expected 1 errors +Line 106: Expected 1 errors +Line 119: Expected 1 errors +Line 132: Expected 1 errors +""" +output = """ +typeddicts_readonly_inheritance.py:36:4: error[invalid-assignment] Cannot assign to key "name" on TypedDict `Album2`: key is marked read-only +typeddicts_readonly_inheritance.py:65:19: error[missing-typed-dict-key] Missing required key 'name' in TypedDict `RequiredName` constructor +typeddicts_readonly_inheritance.py:82:14: error[invalid-assignment] Invalid assignment to key "ident" with declared type `str` on TypedDict `User`: value of type `Literal[3]` +typeddicts_readonly_inheritance.py:83:15: error[invalid-argument-type] Invalid argument to key "ident" with declared type `str` on TypedDict `User`: value of type `Literal[3]` +typeddicts_readonly_inheritance.py:84:5: error[missing-typed-dict-key] Missing required key 'ident' in TypedDict `User` constructor +""" diff --git a/conformance/results/ty/typeddicts_readonly_kwargs.toml b/conformance/results/ty/typeddicts_readonly_kwargs.toml new file mode 100644 index 00000000..2795b28d --- /dev/null +++ b/conformance/results/ty/typeddicts_readonly_kwargs.toml @@ -0,0 +1,7 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 33: Expected 1 errors +""" +output = """ +""" diff --git a/conformance/results/ty/typeddicts_readonly_update.toml b/conformance/results/ty/typeddicts_readonly_update.toml new file mode 100644 index 00000000..267649f8 --- /dev/null +++ b/conformance/results/ty/typeddicts_readonly_update.toml @@ -0,0 +1,7 @@ +conformance_automated = "Fail" +conformant = "Unsupported" +errors_diff = """ +Line 23: Expected 1 errors +""" +output = """ +""" diff --git a/conformance/results/ty/typeddicts_required.toml b/conformance/results/ty/typeddicts_required.toml new file mode 100644 index 00000000..7bf240fd --- /dev/null +++ b/conformance/results/ty/typeddicts_required.toml @@ -0,0 +1,9 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +typeddicts_required.py:12:8: error[invalid-type-form] `Required` is only allowed in TypedDict fields +typeddicts_required.py:16:5: error[invalid-type-form] `NotRequired` is not allowed in function parameter annotations +typeddicts_required.py:59:8: error[invalid-type-form] `typing.Required` cannot be nested inside `Required` or `NotRequired` +typeddicts_required.py:60:8: error[invalid-type-form] `typing.Required` cannot be nested inside `Required` or `NotRequired` +""" diff --git a/conformance/results/ty/typeddicts_type_consistency.toml b/conformance/results/ty/typeddicts_type_consistency.toml new file mode 100644 index 00000000..1048e6cb --- /dev/null +++ b/conformance/results/ty/typeddicts_type_consistency.toml @@ -0,0 +1,15 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +typeddicts_type_consistency.py:21:10: error[invalid-assignment] Object of type `B1` is not assignable to `A1` +typeddicts_type_consistency.py:38:10: error[invalid-assignment] Object of type `B2` is not assignable to `A2` +typeddicts_type_consistency.py:65:6: error[invalid-assignment] Object of type `A3` is not assignable to `B3` +typeddicts_type_consistency.py:69:21: error[invalid-key] Unknown key "y" for TypedDict `A3`: Unknown key "y" +typeddicts_type_consistency.py:76:22: error[invalid-assignment] Object of type `B3` is not assignable to `dict[str, int]` +typeddicts_type_consistency.py:77:25: error[invalid-assignment] Object of type `B3` is not assignable to `dict[str, object]` +typeddicts_type_consistency.py:78:22: error[invalid-assignment] Object of type `B3` is not assignable to `dict[Any, Any]` +typeddicts_type_consistency.py:82:25: error[invalid-assignment] Object of type `B3` is not assignable to `Mapping[str, int]` +typeddicts_type_consistency.py:101:14: error[invalid-assignment] Object of type `Unknown | None` is not assignable to `str` +typeddicts_type_consistency.py:126:56: error[invalid-argument-type] Invalid argument to key "inner_key" with declared type `str` on TypedDict `Inner1`: value of type `Literal[1]` +""" diff --git a/conformance/results/ty/typeddicts_usage.toml b/conformance/results/ty/typeddicts_usage.toml new file mode 100644 index 00000000..fe40d618 --- /dev/null +++ b/conformance/results/ty/typeddicts_usage.toml @@ -0,0 +1,11 @@ +conformance_automated = "Pass" +errors_diff = """ +""" +output = """ +typeddicts_usage.py:23:7: error[invalid-key] Unknown key "director" for TypedDict `Movie`: Unknown key "director" +typeddicts_usage.py:24:17: error[invalid-assignment] Invalid assignment to key "year" with declared type `int` on TypedDict `Movie`: value of type `Literal["1982"]` +typeddicts_usage.py:28:17: error[missing-typed-dict-key] Missing required key 'name' in TypedDict `Movie` constructor +typeddicts_usage.py:28:18: error[invalid-key] Unknown key "title" for TypedDict `Movie`: Unknown key "title" +typeddicts_usage.py:35:4: error[isinstance-against-typed-dict] `TypedDict` class `Movie` cannot be used as the second argument to `isinstance`: This call will raise `TypeError` at runtime +typeddicts_usage.py:40:24: error[invalid-type-form] The special form `typing.TypedDict` is not allowed in type expressions +""" diff --git a/conformance/results/ty/version.toml b/conformance/results/ty/version.toml new file mode 100644 index 00000000..1186fdef --- /dev/null +++ b/conformance/results/ty/version.toml @@ -0,0 +1 @@ +version = "ty 0.0.21" diff --git a/conformance/src/type_checker.py b/conformance/src/type_checker.py index 865821f4..26aeecc2 100644 --- a/conformance/src/type_checker.py +++ b/conformance/src/type_checker.py @@ -2,12 +2,13 @@ Classes that abstract differences between type checkers. """ -from abc import ABC, abstractmethod import json -from pathlib import Path +import re import shutil -from subprocess import PIPE, CalledProcessError, run import sys +from abc import ABC, abstractmethod +from pathlib import Path +from subprocess import PIPE, CalledProcessError, run from typing import Sequence @@ -188,6 +189,66 @@ def parse_errors(self, output: Sequence[str]) -> dict[int, list[str]]: return line_to_errors +class TyTypeChecker(TypeChecker): + @property + def name(self) -> str: + return "ty" + + def install(self) -> bool: + try: + self.get_version() + return True + except (CalledProcessError, FileNotFoundError): + print( + "Unable to run ty. Install conformance dependencies with " + "'uv sync --frozen' from the conformance directory." + ) + return False + + def get_version(self) -> str: + proc = run([sys.executable, "-m", "ty", "--version"], stdout=PIPE, text=True) + return proc.stdout.split("(")[0].strip() + + def run_tests(self, test_files: Sequence[str]) -> dict[str, str]: + command = [ + sys.executable, + "-m", + "ty", + "check", + ".", + "--output-format=concise", + "--color=never", + "--config-file=./ty.toml", + ] + proc = run(command, stdout=PIPE, text=True, encoding="utf-8") + results_dict = {} + for line in proc.stdout.splitlines(): + if not line.strip(): + continue + file_name = line.split(":")[0].strip() + results_dict[file_name] = results_dict.get(file_name, "") + line + "\n" + return results_dict + + def parse_errors(self, output: Sequence[str]) -> dict[int, list[str]]: + # narrowing_typeguard.py:102:23: error[invalid-type-guard-definition] `TypeGuard` function must have a parameter to narrow + line_to_errors: dict[int, list[str]] = {} + for line in output: + line = line.strip() + if ( + not line + or line == "All checks passed!" + or re.fullmatch(r"Found \d+ diagnostics?", line) + ): + continue + assert line.count(":") >= 3, f"Failed to parse line: {line!r}" + _, lineno, _, rest = line.split(":", maxsplit=3) + kind = rest.split("[")[0].strip() + if kind != "error": + continue + line_to_errors.setdefault(int(lineno), []).append(line) + return line_to_errors + + class ZubanLSTypeChecker(MypyTypeChecker): @property def name(self) -> str: @@ -317,4 +378,5 @@ def parse_errors(self, output: Sequence[str]) -> dict[int, list[str]]: PyrightTypeChecker(), ZubanLSTypeChecker(), PyreflyTypeChecker(), + TyTypeChecker(), ) diff --git a/conformance/tests/ty.toml b/conformance/tests/ty.toml new file mode 100644 index 00000000..7fd5f298 --- /dev/null +++ b/conformance/tests/ty.toml @@ -0,0 +1,9 @@ +[environment] +python-version = "3.12" + +[rules] +deprecated = "error" +invalid-legacy-positional-parameter = "error" +redundant-final-classvar = "error" +assert-type-unspellable-subtype = "ignore" +invalid-enum-member-annotation = "error" diff --git a/conformance/uv.lock b/conformance/uv.lock index 2c2c6ba7..d81cd396 100644 --- a/conformance/uv.lock +++ b/conformance/uv.lock @@ -127,6 +127,30 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/b5/11/87d6d29fb5d237229d67973a6c9e06e048f01cf4994dee194ab0ea841814/tomlkit-0.14.0-py3-none-any.whl", hash = "sha256:592064ed85b40fa213469f81ac584f67a4f2992509a7c3ea2d632208623a3680", size = 39310, upload-time = "2026-01-13T01:14:51.965Z" }, ] +[[package]] +name = "ty" +version = "0.0.21" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/ee/20/2ba8fd9493c89c41dfe9dbb73bc70a28b28028463bc0d2897ba8be36230a/ty-0.0.21.tar.gz", hash = "sha256:a4c2ba5d67d64df8fcdefd8b280ac1149d24a73dbda82fa953a0dff9d21400ed", size = 5297967, upload-time = "2026-03-06T01:57:13.809Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/36/70/edf38bb37517531681d1c37f5df64744e5ad02673c02eb48447eae4bea08/ty-0.0.21-py3-none-linux_armv6l.whl", hash = "sha256:7bdf2f572378de78e1f388d24691c89db51b7caf07cf90f2bfcc1d6b18b70a76", size = 10299222, upload-time = "2026-03-06T01:57:16.64Z" }, + { url = "https://files.pythonhosted.org/packages/72/62/0047b0bd19afeefbc7286f20a5f78a2aa39f92b4d89853f0d7185ab89edc/ty-0.0.21-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:7e9613994610431ab8625025bd2880dbcb77c5c9fabdd21134cda12d840a529d", size = 10130513, upload-time = "2026-03-06T01:57:29.93Z" }, + { url = "https://files.pythonhosted.org/packages/a2/20/0b93a9e91aaed23155780258cdfdb4726ef68b6985378ac069bc427291a0/ty-0.0.21-py3-none-macosx_11_0_arm64.whl", hash = "sha256:56d3b198b64dd0a19b2b66e257deaed2ecea568e722ae5352f3c6fb62027f89d", size = 9605425, upload-time = "2026-03-06T01:57:27.115Z" }, + { url = "https://files.pythonhosted.org/packages/ea/fd/9945e2fa2996a1287b1e1d7ce050e97e1f420233b271e770934bfa0880a0/ty-0.0.21-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d23d2c34f7a77d974bb08f0860ef700addc8a683d81a0319f71c08f87506cfd0", size = 10108298, upload-time = "2026-03-06T01:57:35.429Z" }, + { url = "https://files.pythonhosted.org/packages/52/e7/4ec52fcb15f3200826c9f048472c062549a05b0d1ef0b51f32d527b513c4/ty-0.0.21-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:56b01fd2519637a4ca88344f61c96225f540c98ff18bca321d4eaa7bb0f7aa2f", size = 10121556, upload-time = "2026-03-06T01:57:03.242Z" }, + { url = "https://files.pythonhosted.org/packages/ee/c0/ad457be2a8abea0f25549598bd098554540ced66229488daa0d558dad3c8/ty-0.0.21-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e9de7e11c63c6afc40f3e9ba716374add171aee7fabc70b5146a510705c6d41b", size = 10603264, upload-time = "2026-03-06T01:56:52.134Z" }, + { url = "https://files.pythonhosted.org/packages/f8/5b/2ecc7a2175243a4bcb72f5298ae41feabbb93b764bb0dc45722f3752c2c2/ty-0.0.21-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:62f7f5b235c4f7876db305c36997aea07b7af29b1a068f373d0e2547e25f32ff", size = 11196428, upload-time = "2026-03-06T01:57:32.94Z" }, + { url = "https://files.pythonhosted.org/packages/37/f5/aff507d6a901f328ef96a298032b0c11aaaf950a146ed7dd3b5bf2cd3acf/ty-0.0.21-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ee8399f7c453a425291e6688efe430cfae7ab0ac4ffd50eba9f872bf878b54f6", size = 10866355, upload-time = "2026-03-06T01:56:57.831Z" }, + { url = "https://files.pythonhosted.org/packages/be/30/822bbcb92d55b65989aa7ed06d9585f28ade9c9447369194ed4b0fb3b5b9/ty-0.0.21-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:210e7568c9f886c4d01308d751949ee714ad7ad9d7d928d2ba90d329dd880367", size = 10738177, upload-time = "2026-03-06T01:57:11.256Z" }, + { url = "https://files.pythonhosted.org/packages/57/cc/46e7991b6469e93ac2c7e533a028983e402485580150ac864c56352a3a82/ty-0.0.21-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:53508e345b11569f78b21ba8e2b4e61df38a9754947fb3cd9f2ef574367338fb", size = 10079158, upload-time = "2026-03-06T01:57:00.516Z" }, + { url = "https://files.pythonhosted.org/packages/15/c2/0bbdadfbd008240f8f1a87dc877433cb3884436097926107ccf06e618199/ty-0.0.21-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:553e43571f4a35604c36cfd07d8b61a5eb7a714e3c67f8c4ff2cf674fefbaef9", size = 10150535, upload-time = "2026-03-06T01:57:08.815Z" }, + { url = "https://files.pythonhosted.org/packages/c5/b5/2dbdb7b57b5362200ef0a39738ebd31331726328336def0143ac097ee59d/ty-0.0.21-py3-none-musllinux_1_2_i686.whl", hash = "sha256:666f6822e3b9200abfa7e95eb0ddd576460adb8d66b550c0ad2c70abc84a2048", size = 10319803, upload-time = "2026-03-06T01:57:19.106Z" }, + { url = "https://files.pythonhosted.org/packages/72/84/70e52c0b7abc7c2086f9876ef454a73b161d3125315536d8d7e911c94ca4/ty-0.0.21-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:a0854d008347ce4a5fb351af132f660a390ab2a1163444d075251d43e6f74b9b", size = 10826239, upload-time = "2026-03-06T01:57:21.727Z" }, + { url = "https://files.pythonhosted.org/packages/a1/8a/1f72480fd013bbc6cd1929002abbbcde9a0b08ead6a15154de9d7f7fa37e/ty-0.0.21-py3-none-win32.whl", hash = "sha256:bef3ab4c7b966bcc276a8ac6c11b63ba222d21355b48d471ea782c4104eee4e0", size = 9693196, upload-time = "2026-03-06T01:57:24.126Z" }, + { url = "https://files.pythonhosted.org/packages/8d/f8/1104808b875c26c640e536945753a78562d606bef4e241d9dbf3d92477f6/ty-0.0.21-py3-none-win_amd64.whl", hash = "sha256:a709d576e5bea84b745d43058d8b9cd4f27f74a0b24acb4b0cbb7d3d41e0d050", size = 10668660, upload-time = "2026-03-06T01:56:55.06Z" }, + { url = "https://files.pythonhosted.org/packages/1b/b8/25e0adc404bbf986977657b25318991f93097b49f8aea640d93c0b0db68e/ty-0.0.21-py3-none-win_arm64.whl", hash = "sha256:f72047996598ac20553fb7e21ba5741e3c82dee4e9eadf10d954551a5fe09391", size = 10104161, upload-time = "2026-03-06T01:57:06.072Z" }, +] + [[package]] name = "typing-conformance" version = "0.1.0" @@ -137,6 +161,7 @@ dependencies = [ { name = "pyright" }, { name = "tomli" }, { name = "tomlkit" }, + { name = "ty" }, { name = "zuban" }, ] @@ -147,6 +172,7 @@ requires-dist = [ { name = "pyright" }, { name = "tomli" }, { name = "tomlkit" }, + { name = "ty" }, { name = "zuban" }, ]