From 69d7412c1b381148b155a4c373baf29d0ffd31ac Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Thu, 4 Jan 2024 17:31:06 -0700 Subject: [PATCH] Added tests for several more sections of the typing spec (#1554) --- README.md | 2 + .../results/mypy/annotations_coroutines.toml | 3 + .../mypy/annotations_forward_refs.toml | 31 ++ .../results/mypy/annotations_generators.toml | 15 + .../results/mypy/annotations_methods.toml | 7 + .../results/mypy/annotations_typeexpr.toml | 36 +- .../results/mypy/classes_classvar.toml | 31 ++ .../results/mypy/classes_override.toml | 12 + .../results/mypy/directives_assert_type.toml | 11 + conformance/results/mypy/directives_cast.toml | 16 + .../mypy/directives_no_type_check.toml | 3 + .../results/mypy/directives_reveal_type.toml | 11 + .../mypy/directives_type_checking.toml | 3 + .../results/mypy/directives_type_ignore.toml | 10 + .../mypy/directives_type_ignore_file1.toml | 3 + .../mypy/directives_type_ignore_file2.toml | 4 + .../mypy/directives_version_platform.toml | 11 + conformance/results/mypy/overloads_basic.toml | 9 + .../results/mypy/protocols_class_objects.toml | 23 ++ .../results/mypy/protocols_definition.toml | 55 +++ .../results/mypy/protocols_explicit.toml | 13 + .../results/mypy/protocols_generic.toml | 41 +++ .../results/mypy/protocols_merging.toml | 13 + .../results/mypy/protocols_modules.toml | 13 + .../results/mypy/protocols_recursive.toml | 3 + .../mypy/protocols_runtime_checkable.toml | 9 + conformance/results/mypy/protocols_self.toml | 3 + .../results/mypy/protocols_subtyping.toml | 12 + .../results/mypy/protocols_variance.toml | 12 + .../results/mypy/qualifiers_annotated.toml | 26 ++ .../mypy/qualifiers_final_annotation.toml | 38 ++ .../mypy/qualifiers_final_decorator.toml | 18 + .../results/mypy/specialtypes_any.toml | 5 + .../results/mypy/specialtypes_never.toml | 11 + .../results/mypy/specialtypes_none.toml | 6 + .../results/mypy/specialtypes_promotions.toml | 4 + .../results/mypy/specialtypes_tuple.toml | 10 + .../mypy/specialtypes_tuple_unpack.toml | 14 + .../results/mypy/specialtypes_type.toml | 20 + .../results/mypy/typeddicts_alt_syntax.toml | 2 +- conformance/results/mypy/version.toml | 2 +- .../results/pyre/annotations_coroutines.toml | 7 + .../pyre/annotations_forward_refs.toml | 28 ++ .../results/pyre/annotations_generators.toml | 22 ++ .../results/pyre/annotations_methods.toml | 6 + .../results/pyre/annotations_typeexpr.toml | 33 +- .../results/pyre/classes_classvar.toml | 27 ++ .../results/pyre/classes_override.toml | 22 ++ .../results/pyre/directives_assert_type.toml | 8 + conformance/results/pyre/directives_cast.toml | 6 + .../pyre/directives_no_type_check.toml | 11 + .../results/pyre/directives_reveal_type.toml | 8 + .../pyre/directives_type_checking.toml | 3 + .../results/pyre/directives_type_ignore.toml | 3 + .../pyre/directives_type_ignore_file1.toml | 7 + .../pyre/directives_type_ignore_file2.toml | 4 + .../pyre/directives_version_platform.toml | 11 + conformance/results/pyre/overloads_basic.toml | 8 + .../results/pyre/protocols_class_objects.toml | 12 + .../results/pyre/protocols_definition.toml | 24 ++ .../results/pyre/protocols_explicit.toml | 15 + .../results/pyre/protocols_generic.toml | 13 + .../results/pyre/protocols_merging.toml | 11 + .../results/pyre/protocols_modules.toml | 6 + .../results/pyre/protocols_recursive.toml | 3 + .../pyre/protocols_runtime_checkable.toml | 8 + conformance/results/pyre/protocols_self.toml | 3 + .../results/pyre/protocols_subtyping.toml | 10 + .../results/pyre/protocols_variance.toml | 8 + .../results/pyre/qualifiers_annotated.toml | 18 + .../pyre/qualifiers_final_annotation.toml | 34 ++ .../pyre/qualifiers_final_decorator.toml | 18 + .../results/pyre/specialtypes_any.toml | 14 + .../results/pyre/specialtypes_never.toml | 17 + .../results/pyre/specialtypes_none.toml | 10 + .../results/pyre/specialtypes_promotions.toml | 6 + .../results/pyre/specialtypes_tuple.toml | 11 + .../pyre/specialtypes_tuple_unpack.toml | 43 +++ .../results/pyre/specialtypes_type.toml | 25 ++ conformance/results/pyre/version.toml | 2 +- .../results/pyright/aliases_explicit.toml | 10 +- .../results/pyright/aliases_implicit.toml | 10 +- .../results/pyright/aliases_newtype.toml | 17 +- .../pyright/aliases_type_statement.toml | 33 +- .../pyright/aliases_typealiastype.toml | 30 +- .../pyright/annotations_coroutines.toml | 3 + .../pyright/annotations_forward_refs.toml | 37 ++ .../pyright/annotations_generators.toml | 33 ++ .../results/pyright/annotations_methods.toml | 8 + .../results/pyright/annotations_typeexpr.toml | 40 +- .../results/pyright/callables_protocol.toml | 8 +- .../results/pyright/classes_classvar.toml | 24 ++ .../results/pyright/classes_override.toml | 8 + .../results/pyright/dataclasses_postinit.toml | 7 +- .../pyright/directives_assert_type.toml | 9 + .../results/pyright/directives_cast.toml | 8 + .../pyright/directives_no_type_check.toml | 14 + .../pyright/directives_reveal_type.toml | 9 + .../pyright/directives_type_checking.toml | 3 + .../pyright/directives_type_ignore.toml | 3 + .../pyright/directives_type_ignore_file1.toml | 3 + .../pyright/directives_type_ignore_file2.toml | 5 + .../pyright/directives_version_platform.toml | 3 + .../results/pyright/overloads_basic.toml | 8 + .../pyright/protocols_class_objects.toml | 28 ++ .../results/pyright/protocols_definition.toml | 89 +++++ .../results/pyright/protocols_explicit.toml | 26 ++ .../results/pyright/protocols_generic.toml | 40 ++ .../results/pyright/protocols_merging.toml | 16 + .../results/pyright/protocols_modules.toml | 14 + .../results/pyright/protocols_recursive.toml | 3 + .../pyright/protocols_runtime_checkable.toml | 9 + .../results/pyright/protocols_self.toml | 3 + .../results/pyright/protocols_subtyping.toml | 25 ++ .../results/pyright/protocols_variance.toml | 16 + .../results/pyright/qualifiers_annotated.toml | 23 ++ .../pyright/qualifiers_final_annotation.toml | 38 ++ .../pyright/qualifiers_final_decorator.toml | 17 + .../results/pyright/specialtypes_any.toml | 3 + .../results/pyright/specialtypes_never.toml | 14 + .../results/pyright/specialtypes_none.toml | 10 + .../pyright/specialtypes_promotions.toml | 5 + .../results/pyright/specialtypes_tuple.toml | 22 ++ .../pyright/specialtypes_tuple_unpack.toml | 29 ++ .../results/pyright/specialtypes_type.toml | 25 ++ conformance/results/pyright/version.toml | 4 +- .../pytype/annotations_coroutines.toml | 9 + .../pytype/annotations_forward_refs.toml | 45 +++ .../pytype/annotations_generators.toml | 40 ++ .../results/pytype/annotations_methods.toml | 9 + .../results/pytype/annotations_typeexpr.toml | 19 +- .../results/pytype/classes_classvar.toml | 45 +++ .../results/pytype/classes_override.toml | 20 + .../pytype/directives_assert_type.toml | 18 + .../results/pytype/directives_cast.toml | 11 + .../pytype/directives_no_type_check.toml | 17 + .../pytype/directives_reveal_type.toml | 12 + .../pytype/directives_type_checking.toml | 3 + .../pytype/directives_type_ignore.toml | 10 + .../pytype/directives_type_ignore_file1.toml | 3 + .../pytype/directives_type_ignore_file2.toml | 6 + .../pytype/directives_version_platform.toml | 16 + .../results/pytype/overloads_basic.toml | 16 + .../pytype/protocols_class_objects.toml | 8 + .../results/pytype/protocols_definition.toml | 50 +++ .../results/pytype/protocols_explicit.toml | 17 + .../results/pytype/protocols_generic.toml | 36 ++ .../results/pytype/protocols_merging.toml | 22 ++ .../results/pytype/protocols_modules.toml | 8 + .../results/pytype/protocols_recursive.toml | 10 + .../pytype/protocols_runtime_checkable.toml | 8 + .../results/pytype/protocols_self.toml | 29 ++ .../results/pytype/protocols_subtyping.toml | 16 + .../results/pytype/protocols_variance.toml | 11 + .../results/pytype/qualifiers_annotated.toml | 27 ++ .../pytype/qualifiers_final_annotation.toml | 45 +++ .../pytype/qualifiers_final_decorator.toml | 36 ++ .../results/pytype/specialtypes_any.toml | 3 + .../results/pytype/specialtypes_never.toml | 22 ++ .../results/pytype/specialtypes_none.toml | 13 + .../pytype/specialtypes_promotions.toml | 4 + .../results/pytype/specialtypes_tuple.toml | 21 ++ .../pytype/specialtypes_tuple_unpack.toml | 215 +++++++++++ .../results/pytype/specialtypes_type.toml | 32 ++ conformance/results/pytype/version.toml | 2 +- conformance/results/results.html | 246 ++++++++++++- conformance/tests/_protocols_modules1.py | 7 + conformance/tests/_protocols_modules2.py | 11 + .../tests/_qualifiers_final_decorator.pyi | 29 ++ conformance/tests/annotations_coroutines.py | 24 ++ conformance/tests/annotations_forward_refs.py | 93 +++++ conformance/tests/annotations_generators.py | 190 ++++++++++ conformance/tests/annotations_methods.py | 51 +++ conformance/tests/annotations_typeexpr.py | 33 +- conformance/tests/classes_classvar.py | 156 ++++++++ conformance/tests/classes_override.py | 104 ++++++ conformance/tests/directives_assert_type.py | 37 ++ conformance/tests/directives_cast.py | 17 + conformance/tests/directives_no_type_check.py | 21 ++ conformance/tests/directives_reveal_type.py | 24 ++ conformance/tests/directives_type_checking.py | 19 + conformance/tests/directives_type_ignore.py | 20 + .../tests/directives_type_ignore_file1.py | 16 + .../tests/directives_type_ignore_file2.py | 14 + .../tests/directives_version_platform.py | 45 +++ conformance/tests/overloads_basic.py | 81 +++++ conformance/tests/protocols_class_objects.py | 106 ++++++ conformance/tests/protocols_definition.py | 341 ++++++++++++++++++ conformance/tests/protocols_explicit.py | 178 +++++++++ conformance/tests/protocols_generic.py | 147 ++++++++ conformance/tests/protocols_merging.py | 84 +++++ conformance/tests/protocols_modules.py | 49 +++ conformance/tests/protocols_recursive.py | 80 ++++ .../tests/protocols_runtime_checkable.py | 89 +++++ conformance/tests/protocols_self.py | 73 ++++ conformance/tests/protocols_subtyping.py | 142 ++++++++ conformance/tests/protocols_variance.py | 122 +++++++ conformance/tests/qualifiers_annotated.py | 96 +++++ .../tests/qualifiers_final_annotation.py | 155 ++++++++ .../tests/qualifiers_final_decorator.py | 127 +++++++ conformance/tests/specialtypes_any.py | 90 +++++ conformance/tests/specialtypes_never.py | 104 ++++++ conformance/tests/specialtypes_none.py | 41 +++ conformance/tests/specialtypes_promotions.py | 16 + conformance/tests/specialtypes_tuple.py | 43 +++ .../tests/specialtypes_tuple_unpack.py | 41 +++ conformance/tests/specialtypes_type.py | 175 +++++++++ 207 files changed, 6205 insertions(+), 154 deletions(-) create mode 100644 conformance/results/mypy/annotations_coroutines.toml create mode 100644 conformance/results/mypy/annotations_forward_refs.toml create mode 100644 conformance/results/mypy/annotations_generators.toml create mode 100644 conformance/results/mypy/annotations_methods.toml create mode 100644 conformance/results/mypy/classes_classvar.toml create mode 100644 conformance/results/mypy/classes_override.toml create mode 100644 conformance/results/mypy/directives_assert_type.toml create mode 100644 conformance/results/mypy/directives_cast.toml create mode 100644 conformance/results/mypy/directives_no_type_check.toml create mode 100644 conformance/results/mypy/directives_reveal_type.toml create mode 100644 conformance/results/mypy/directives_type_checking.toml create mode 100644 conformance/results/mypy/directives_type_ignore.toml create mode 100644 conformance/results/mypy/directives_type_ignore_file1.toml create mode 100644 conformance/results/mypy/directives_type_ignore_file2.toml create mode 100644 conformance/results/mypy/directives_version_platform.toml create mode 100644 conformance/results/mypy/overloads_basic.toml create mode 100644 conformance/results/mypy/protocols_class_objects.toml create mode 100644 conformance/results/mypy/protocols_definition.toml create mode 100644 conformance/results/mypy/protocols_explicit.toml create mode 100644 conformance/results/mypy/protocols_generic.toml create mode 100644 conformance/results/mypy/protocols_merging.toml create mode 100644 conformance/results/mypy/protocols_modules.toml create mode 100644 conformance/results/mypy/protocols_recursive.toml create mode 100644 conformance/results/mypy/protocols_runtime_checkable.toml create mode 100644 conformance/results/mypy/protocols_self.toml create mode 100644 conformance/results/mypy/protocols_subtyping.toml create mode 100644 conformance/results/mypy/protocols_variance.toml create mode 100644 conformance/results/mypy/qualifiers_annotated.toml create mode 100644 conformance/results/mypy/qualifiers_final_annotation.toml create mode 100644 conformance/results/mypy/qualifiers_final_decorator.toml create mode 100644 conformance/results/mypy/specialtypes_any.toml create mode 100644 conformance/results/mypy/specialtypes_never.toml create mode 100644 conformance/results/mypy/specialtypes_none.toml create mode 100644 conformance/results/mypy/specialtypes_promotions.toml create mode 100644 conformance/results/mypy/specialtypes_tuple.toml create mode 100644 conformance/results/mypy/specialtypes_tuple_unpack.toml create mode 100644 conformance/results/mypy/specialtypes_type.toml create mode 100644 conformance/results/pyre/annotations_coroutines.toml create mode 100644 conformance/results/pyre/annotations_forward_refs.toml create mode 100644 conformance/results/pyre/annotations_generators.toml create mode 100644 conformance/results/pyre/annotations_methods.toml create mode 100644 conformance/results/pyre/classes_classvar.toml create mode 100644 conformance/results/pyre/classes_override.toml create mode 100644 conformance/results/pyre/directives_assert_type.toml create mode 100644 conformance/results/pyre/directives_cast.toml create mode 100644 conformance/results/pyre/directives_no_type_check.toml create mode 100644 conformance/results/pyre/directives_reveal_type.toml create mode 100644 conformance/results/pyre/directives_type_checking.toml create mode 100644 conformance/results/pyre/directives_type_ignore.toml create mode 100644 conformance/results/pyre/directives_type_ignore_file1.toml create mode 100644 conformance/results/pyre/directives_type_ignore_file2.toml create mode 100644 conformance/results/pyre/directives_version_platform.toml create mode 100644 conformance/results/pyre/overloads_basic.toml create mode 100644 conformance/results/pyre/protocols_class_objects.toml create mode 100644 conformance/results/pyre/protocols_definition.toml create mode 100644 conformance/results/pyre/protocols_explicit.toml create mode 100644 conformance/results/pyre/protocols_generic.toml create mode 100644 conformance/results/pyre/protocols_merging.toml create mode 100644 conformance/results/pyre/protocols_modules.toml create mode 100644 conformance/results/pyre/protocols_recursive.toml create mode 100644 conformance/results/pyre/protocols_runtime_checkable.toml create mode 100644 conformance/results/pyre/protocols_self.toml create mode 100644 conformance/results/pyre/protocols_subtyping.toml create mode 100644 conformance/results/pyre/protocols_variance.toml create mode 100644 conformance/results/pyre/qualifiers_annotated.toml create mode 100644 conformance/results/pyre/qualifiers_final_annotation.toml create mode 100644 conformance/results/pyre/qualifiers_final_decorator.toml create mode 100644 conformance/results/pyre/specialtypes_any.toml create mode 100644 conformance/results/pyre/specialtypes_never.toml create mode 100644 conformance/results/pyre/specialtypes_none.toml create mode 100644 conformance/results/pyre/specialtypes_promotions.toml create mode 100644 conformance/results/pyre/specialtypes_tuple.toml create mode 100644 conformance/results/pyre/specialtypes_tuple_unpack.toml create mode 100644 conformance/results/pyre/specialtypes_type.toml create mode 100644 conformance/results/pyright/annotations_coroutines.toml create mode 100644 conformance/results/pyright/annotations_forward_refs.toml create mode 100644 conformance/results/pyright/annotations_generators.toml create mode 100644 conformance/results/pyright/annotations_methods.toml create mode 100644 conformance/results/pyright/classes_classvar.toml create mode 100644 conformance/results/pyright/classes_override.toml create mode 100644 conformance/results/pyright/directives_assert_type.toml create mode 100644 conformance/results/pyright/directives_cast.toml create mode 100644 conformance/results/pyright/directives_no_type_check.toml create mode 100644 conformance/results/pyright/directives_reveal_type.toml create mode 100644 conformance/results/pyright/directives_type_checking.toml create mode 100644 conformance/results/pyright/directives_type_ignore.toml create mode 100644 conformance/results/pyright/directives_type_ignore_file1.toml create mode 100644 conformance/results/pyright/directives_type_ignore_file2.toml create mode 100644 conformance/results/pyright/directives_version_platform.toml create mode 100644 conformance/results/pyright/overloads_basic.toml create mode 100644 conformance/results/pyright/protocols_class_objects.toml create mode 100644 conformance/results/pyright/protocols_definition.toml create mode 100644 conformance/results/pyright/protocols_explicit.toml create mode 100644 conformance/results/pyright/protocols_generic.toml create mode 100644 conformance/results/pyright/protocols_merging.toml create mode 100644 conformance/results/pyright/protocols_modules.toml create mode 100644 conformance/results/pyright/protocols_recursive.toml create mode 100644 conformance/results/pyright/protocols_runtime_checkable.toml create mode 100644 conformance/results/pyright/protocols_self.toml create mode 100644 conformance/results/pyright/protocols_subtyping.toml create mode 100644 conformance/results/pyright/protocols_variance.toml create mode 100644 conformance/results/pyright/qualifiers_annotated.toml create mode 100644 conformance/results/pyright/qualifiers_final_annotation.toml create mode 100644 conformance/results/pyright/qualifiers_final_decorator.toml create mode 100644 conformance/results/pyright/specialtypes_any.toml create mode 100644 conformance/results/pyright/specialtypes_never.toml create mode 100644 conformance/results/pyright/specialtypes_none.toml create mode 100644 conformance/results/pyright/specialtypes_promotions.toml create mode 100644 conformance/results/pyright/specialtypes_tuple.toml create mode 100644 conformance/results/pyright/specialtypes_tuple_unpack.toml create mode 100644 conformance/results/pyright/specialtypes_type.toml create mode 100644 conformance/results/pytype/annotations_coroutines.toml create mode 100644 conformance/results/pytype/annotations_forward_refs.toml create mode 100644 conformance/results/pytype/annotations_generators.toml create mode 100644 conformance/results/pytype/annotations_methods.toml create mode 100644 conformance/results/pytype/classes_classvar.toml create mode 100644 conformance/results/pytype/classes_override.toml create mode 100644 conformance/results/pytype/directives_assert_type.toml create mode 100644 conformance/results/pytype/directives_cast.toml create mode 100644 conformance/results/pytype/directives_no_type_check.toml create mode 100644 conformance/results/pytype/directives_reveal_type.toml create mode 100644 conformance/results/pytype/directives_type_checking.toml create mode 100644 conformance/results/pytype/directives_type_ignore.toml create mode 100644 conformance/results/pytype/directives_type_ignore_file1.toml create mode 100644 conformance/results/pytype/directives_type_ignore_file2.toml create mode 100644 conformance/results/pytype/directives_version_platform.toml create mode 100644 conformance/results/pytype/overloads_basic.toml create mode 100644 conformance/results/pytype/protocols_class_objects.toml create mode 100644 conformance/results/pytype/protocols_definition.toml create mode 100644 conformance/results/pytype/protocols_explicit.toml create mode 100644 conformance/results/pytype/protocols_generic.toml create mode 100644 conformance/results/pytype/protocols_merging.toml create mode 100644 conformance/results/pytype/protocols_modules.toml create mode 100644 conformance/results/pytype/protocols_recursive.toml create mode 100644 conformance/results/pytype/protocols_runtime_checkable.toml create mode 100644 conformance/results/pytype/protocols_self.toml create mode 100644 conformance/results/pytype/protocols_subtyping.toml create mode 100644 conformance/results/pytype/protocols_variance.toml create mode 100644 conformance/results/pytype/qualifiers_annotated.toml create mode 100644 conformance/results/pytype/qualifiers_final_annotation.toml create mode 100644 conformance/results/pytype/qualifiers_final_decorator.toml create mode 100644 conformance/results/pytype/specialtypes_any.toml create mode 100644 conformance/results/pytype/specialtypes_never.toml create mode 100644 conformance/results/pytype/specialtypes_none.toml create mode 100644 conformance/results/pytype/specialtypes_promotions.toml create mode 100644 conformance/results/pytype/specialtypes_tuple.toml create mode 100644 conformance/results/pytype/specialtypes_tuple_unpack.toml create mode 100644 conformance/results/pytype/specialtypes_type.toml create mode 100644 conformance/tests/_protocols_modules1.py create mode 100644 conformance/tests/_protocols_modules2.py create mode 100644 conformance/tests/_qualifiers_final_decorator.pyi create mode 100644 conformance/tests/annotations_coroutines.py create mode 100644 conformance/tests/annotations_forward_refs.py create mode 100644 conformance/tests/annotations_generators.py create mode 100644 conformance/tests/annotations_methods.py create mode 100644 conformance/tests/classes_classvar.py create mode 100644 conformance/tests/classes_override.py create mode 100644 conformance/tests/directives_assert_type.py create mode 100644 conformance/tests/directives_cast.py create mode 100644 conformance/tests/directives_no_type_check.py create mode 100644 conformance/tests/directives_reveal_type.py create mode 100644 conformance/tests/directives_type_checking.py create mode 100644 conformance/tests/directives_type_ignore.py create mode 100644 conformance/tests/directives_type_ignore_file1.py create mode 100644 conformance/tests/directives_type_ignore_file2.py create mode 100644 conformance/tests/directives_version_platform.py create mode 100644 conformance/tests/overloads_basic.py create mode 100644 conformance/tests/protocols_class_objects.py create mode 100644 conformance/tests/protocols_definition.py create mode 100644 conformance/tests/protocols_explicit.py create mode 100644 conformance/tests/protocols_generic.py create mode 100644 conformance/tests/protocols_merging.py create mode 100644 conformance/tests/protocols_modules.py create mode 100644 conformance/tests/protocols_recursive.py create mode 100644 conformance/tests/protocols_runtime_checkable.py create mode 100644 conformance/tests/protocols_self.py create mode 100644 conformance/tests/protocols_subtyping.py create mode 100644 conformance/tests/protocols_variance.py create mode 100644 conformance/tests/qualifiers_annotated.py create mode 100644 conformance/tests/qualifiers_final_annotation.py create mode 100644 conformance/tests/qualifiers_final_decorator.py create mode 100644 conformance/tests/specialtypes_any.py create mode 100644 conformance/tests/specialtypes_never.py create mode 100644 conformance/tests/specialtypes_none.py create mode 100644 conformance/tests/specialtypes_promotions.py create mode 100644 conformance/tests/specialtypes_tuple.py create mode 100644 conformance/tests/specialtypes_tuple_unpack.py create mode 100644 conformance/tests/specialtypes_type.py diff --git a/README.md b/README.md index 9809cd697..eb7472be0 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ This GitHub repository is used for several things: - A [discussion forum](https://github.com/python/typing/discussions) for typing-related user help is hosted here. +- [Conformance test](https://github.com/python/typing/blob/main/conformance/README.md) for Python static type checkers. The [latest conformance test results](https://htmlpreview.github.io/?https://github.com/python/typing/blob/main/conformance/results/results.html) are here. + Historically, this repository also hosted: - The `typing_extensions` package, which now lives in the diff --git a/conformance/results/mypy/annotations_coroutines.toml b/conformance/results/mypy/annotations_coroutines.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/mypy/annotations_coroutines.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/mypy/annotations_forward_refs.toml b/conformance/results/mypy/annotations_forward_refs.toml new file mode 100644 index 000000000..34a604c35 --- /dev/null +++ b/conformance/results/mypy/annotations_forward_refs.toml @@ -0,0 +1,31 @@ +conformant = "Partial" +notes = """ +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. +""" +output = """ +annotations_forward_refs.py:41: error: Invalid type comment or annotation [valid-type] +annotations_forward_refs.py:42: error: Invalid type comment or annotation [valid-type] +annotations_forward_refs.py:43: error: Invalid type comment or annotation [valid-type] +annotations_forward_refs.py:44: error: Invalid type comment or annotation [valid-type] +annotations_forward_refs.py:45: error: Invalid type comment or annotation [valid-type] +annotations_forward_refs.py:46: error: Invalid type comment or annotation [valid-type] +annotations_forward_refs.py:47: error: Invalid type comment or annotation [valid-type] +annotations_forward_refs.py:48: error: Invalid type comment or annotation [valid-type] +annotations_forward_refs.py:49: error: Variable "annotations_forward_refs.var1" is not valid as a type [valid-type] +annotations_forward_refs.py:49: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases +annotations_forward_refs.py:50: error: Invalid type comment or annotation [valid-type] +annotations_forward_refs.py:51: error: Invalid type comment or annotation [valid-type] +annotations_forward_refs.py:52: error: Invalid type comment or annotation [valid-type] +annotations_forward_refs.py:53: error: Invalid type comment or annotation [valid-type] +annotations_forward_refs.py:54: error: Invalid type comment or annotation [valid-type] +annotations_forward_refs.py:55: error: Module "types" is not valid as a type [valid-type] +annotations_forward_refs.py:55: note: Perhaps you meant to use a protocol matching the module structure? +annotations_forward_refs.py:80: error: Name "ClassF" is not defined [name-defined] +annotations_forward_refs.py:87: error: Function "annotations_forward_refs.ClassD.int" is not valid as a type [valid-type] +annotations_forward_refs.py:87: note: Perhaps you need "Callable[...]" or a callback protocol? +annotations_forward_refs.py:89: error: Function "annotations_forward_refs.ClassD.int" is not valid as a type [valid-type] +annotations_forward_refs.py:89: note: Perhaps you need "Callable[...]" or a callback protocol? +annotations_forward_refs.py:93: error: Expression is of type int?, not "int" [assert-type] +""" diff --git a/conformance/results/mypy/annotations_generators.toml b/conformance/results/mypy/annotations_generators.toml new file mode 100644 index 000000000..fbeeb9cdf --- /dev/null +++ b/conformance/results/mypy/annotations_generators.toml @@ -0,0 +1,15 @@ +conformant = "Partial" +notes = """ +Does not report incompatible Generator type in `yield from` statement. +""" +output = """ +annotations_generators.py:51: error: Missing return statement [return] +annotations_generators.py:54: error: Incompatible return value type (got "bool", expected "C") [return-value] +annotations_generators.py:57: error: Incompatible types in "yield" (actual type "int", expected type "A") [misc] +annotations_generators.py:66: error: Incompatible types in "yield" (actual type "int", expected type "A") [misc] +annotations_generators.py:75: error: Incompatible types in "yield" (actual type "B", expected type "A") [misc] +annotations_generators.py:86: error: The return type of a generator function should be "Generator" or one of its supertypes [misc] +annotations_generators.py:91: error: The return type of an async generator function should be "AsyncGenerator" or one of its supertypes [misc] +annotations_generators.py:118: error: Incompatible types in "yield from" (actual type "A", expected type "B") [misc] +annotations_generators.py:119: error: Incompatible types in "yield from" (actual type "int", expected type "B") [misc] +""" diff --git a/conformance/results/mypy/annotations_methods.toml b/conformance/results/mypy/annotations_methods.toml new file mode 100644 index 000000000..cbbdd307c --- /dev/null +++ b/conformance/results/mypy/annotations_methods.toml @@ -0,0 +1,7 @@ +conformant = "Pass" +notes = """ +Type evaluation differs from other type checkers because of ambiguity in the spec related to method bindings. +""" +output = """ +annotations_methods.py:42: error: Expression is of type "B", not "A" [assert-type] +""" diff --git a/conformance/results/mypy/annotations_typeexpr.toml b/conformance/results/mypy/annotations_typeexpr.toml index b5caec86b..501db9cb4 100644 --- a/conformance/results/mypy/annotations_typeexpr.toml +++ b/conformance/results/mypy/annotations_typeexpr.toml @@ -1,20 +1,22 @@ conformant = "Pass" output = """ -annotations_typeexpr.py:77: error: Invalid type comment or annotation [valid-type] -annotations_typeexpr.py:77: note: Suggestion: use eval[...] instead of eval(...) -annotations_typeexpr.py:78: error: Bracketed expression "[...]" is not valid as a type [valid-type] -annotations_typeexpr.py:79: error: Syntax error in type annotation [syntax] -annotations_typeexpr.py:79: note: Suggestion: Use Tuple[T1, ..., Tn] instead of (T1, ..., Tn) -annotations_typeexpr.py:80: error: Invalid type comment or annotation [valid-type] -annotations_typeexpr.py:81: error: Invalid type comment or annotation [valid-type] -annotations_typeexpr.py:82: error: Invalid type comment or annotation [valid-type] -annotations_typeexpr.py:83: error: Invalid type comment or annotation [valid-type] -annotations_typeexpr.py:84: error: Invalid type comment or annotation [valid-type] -annotations_typeexpr.py:85: error: Variable "annotations_typeexpr.var1" is not valid as a type [valid-type] -annotations_typeexpr.py:85: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases -annotations_typeexpr.py:86: error: Invalid type: try using Literal[True] instead? [valid-type] -annotations_typeexpr.py:87: error: Invalid type: try using Literal[1] instead? [valid-type] -annotations_typeexpr.py:88: error: Invalid type: try using Literal[-1] instead? [valid-type] -annotations_typeexpr.py:89: error: Invalid type comment or annotation [valid-type] -annotations_typeexpr.py:90: error: Invalid type comment or annotation [valid-type] +annotations_typeexpr.py:88: error: Invalid type comment or annotation [valid-type] +annotations_typeexpr.py:88: note: Suggestion: use eval[...] instead of eval(...) +annotations_typeexpr.py:89: error: Bracketed expression "[...]" is not valid as a type [valid-type] +annotations_typeexpr.py:90: error: Syntax error in type annotation [syntax] +annotations_typeexpr.py:90: note: Suggestion: Use Tuple[T1, ..., Tn] instead of (T1, ..., Tn) +annotations_typeexpr.py:91: error: Invalid type comment or annotation [valid-type] +annotations_typeexpr.py:92: error: Invalid type comment or annotation [valid-type] +annotations_typeexpr.py:93: error: Invalid type comment or annotation [valid-type] +annotations_typeexpr.py:94: error: Invalid type comment or annotation [valid-type] +annotations_typeexpr.py:95: error: Invalid type comment or annotation [valid-type] +annotations_typeexpr.py:96: error: Variable "annotations_typeexpr.var1" is not valid as a type [valid-type] +annotations_typeexpr.py:96: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases +annotations_typeexpr.py:97: error: Invalid type: try using Literal[True] instead? [valid-type] +annotations_typeexpr.py:98: error: Invalid type: try using Literal[1] instead? [valid-type] +annotations_typeexpr.py:99: error: Invalid type: try using Literal[-1] instead? [valid-type] +annotations_typeexpr.py:100: error: Invalid type comment or annotation [valid-type] +annotations_typeexpr.py:101: error: Invalid type comment or annotation [valid-type] +annotations_typeexpr.py:102: error: Module "types" is not valid as a type [valid-type] +annotations_typeexpr.py:102: note: Perhaps you meant to use a protocol matching the module structure? """ diff --git a/conformance/results/mypy/classes_classvar.toml b/conformance/results/mypy/classes_classvar.toml new file mode 100644 index 000000000..ddb1a097d --- /dev/null +++ b/conformance/results/mypy/classes_classvar.toml @@ -0,0 +1,31 @@ +conformant = "Partial" +notes = """ +Internal error if TypeVarTuple is used in ClassVar. +Does not reject use of ParamSpec in ClassVar. +Rejects ClassVar nested in Annotated. +Does not reject use of ClassVar in TypeAlias definition. +Does not infer type of ClassVar from assignment if no type is provided. +""" +output = """ +classes_classvar.py:36: error: ClassVar[...] must have at most one type argument [valid-type] +classes_classvar.py:37: error: Invalid type: try using Literal[3] instead? [valid-type] +classes_classvar.py:38: error: Name "var" is not defined [name-defined] +classes_classvar.py:43: error: ClassVar cannot contain type variables [misc] +classes_classvar.py:44: error: ClassVar cannot contain type variables [misc] +classes_classvar.py:50: error: Incompatible types in assignment (expression has type "dict[Never, Never]", variable has type "list[str]") [assignment] +classes_classvar.py:52: error: Name "Final" is not defined [name-defined] +classes_classvar.py:53: error: Invalid type: ClassVar nested inside other type [valid-type] +classes_classvar.py:59: error: Invalid type: ClassVar nested inside other type [valid-type] +classes_classvar.py:61: error: ClassVar can only be used for assignments in class body [misc] +classes_classvar.py:62: error: ClassVar can only be used for assignments in class body [misc] +classes_classvar.py:63: error: ClassVar can only be used for assignments in class body [misc] +classes_classvar.py:65: error: ClassVar can only be used for assignments in class body [misc] +classes_classvar.py:69: error: ClassVar can only be used for assignments in class body [misc] +classes_classvar.py:76: error: Expression is of type "Any", not "float" [assert-type] +classes_classvar.py:100: error: Cannot assign to class variable "stats" via instance [misc] +classes_classvar.py:129: error: Incompatible types in assignment (expression has type "ProtoAImpl", variable has type "ProtoA") [assignment] +classes_classvar.py:129: note: "ProtoAImpl" is missing following "ProtoA" protocol member: +classes_classvar.py:129: note: z +classes_classvar.py:129: note: Protocol member ProtoA.x expected class variable, got instance variable +classes_classvar.py:129: note: Protocol member ProtoA.y expected class variable, got instance variable +""" diff --git a/conformance/results/mypy/classes_override.toml b/conformance/results/mypy/classes_override.toml new file mode 100644 index 000000000..ca0ea7847 --- /dev/null +++ b/conformance/results/mypy/classes_override.toml @@ -0,0 +1,12 @@ +conformant = "Partial" +notes = """ +Does not handle case where parent class derives from Any. +""" +output = """ +classes_override.py:53: error: Method "method3" is marked as an override, but no base method was found with this name [misc] +classes_override.py:56: error: Method "method4" is marked as an override, but no base method was found with this name [misc] +classes_override.py:79: error: Method "static_method1" is marked as an override, but no base method was found with this name [misc] +classes_override.py:84: error: Method "class_method1" is marked as an override, but no base method was found with this name [misc] +classes_override.py:91: error: Method "property1" is marked as an override, but no base method was found with this name [misc] +classes_override.py:103: error: Method "method1" is marked as an override, but no base method was found with this name [misc] +""" diff --git a/conformance/results/mypy/directives_assert_type.toml b/conformance/results/mypy/directives_assert_type.toml new file mode 100644 index 000000000..ed6efb743 --- /dev/null +++ b/conformance/results/mypy/directives_assert_type.toml @@ -0,0 +1,11 @@ +conformant = "Pass" +output = """ +directives_assert_type.py:27: error: Expression is of type "int | str", not "int" [assert-type] +directives_assert_type.py:28: error: Expression is of type "Any", not "int" [assert-type] +directives_assert_type.py:29: error: Expression is of type "Literal[4]", not "int" [assert-type] +directives_assert_type.py:31: error: "assert_type" expects 2 arguments [misc] +directives_assert_type.py:31: error: Too few arguments for "assert_type" [call-arg] +directives_assert_type.py:32: error: Expression is of type "Literal['']", not "int" [assert-type] +directives_assert_type.py:33: error: "assert_type" expects 2 arguments [misc] +directives_assert_type.py:33: error: Too many arguments for "assert_type" [call-arg] +""" diff --git a/conformance/results/mypy/directives_cast.toml b/conformance/results/mypy/directives_cast.toml new file mode 100644 index 000000000..c0119f44c --- /dev/null +++ b/conformance/results/mypy/directives_cast.toml @@ -0,0 +1,16 @@ +conformant = "Pass" +output = """ +directives_cast.py:15: error: "cast" expects 2 arguments [misc] +directives_cast.py:15: error: All overload variants of "cast" require at least one argument [call-overload] +directives_cast.py:15: note: Possible overload variants: +directives_cast.py:15: note: def [_T] cast(typ: type[_T], val: Any) -> _T +directives_cast.py:15: note: def cast(typ: str, val: Any) -> Any +directives_cast.py:15: note: def cast(typ: object, val: Any) -> Any +directives_cast.py:16: error: Invalid type: try using Literal[1] instead? [valid-type] +directives_cast.py:17: error: "cast" expects 2 arguments [misc] +directives_cast.py:17: error: No overload variant of "cast" matches argument types "Any", "str", "str" [call-overload] +directives_cast.py:17: note: Possible overload variants: +directives_cast.py:17: note: def [_T] cast(typ: type[_T], val: Any) -> _T +directives_cast.py:17: note: def cast(typ: str, val: Any) -> Any +directives_cast.py:17: note: def cast(typ: object, val: Any) -> Any +""" diff --git a/conformance/results/mypy/directives_no_type_check.toml b/conformance/results/mypy/directives_no_type_check.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/mypy/directives_no_type_check.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/mypy/directives_reveal_type.toml b/conformance/results/mypy/directives_reveal_type.toml new file mode 100644 index 000000000..6612496cc --- /dev/null +++ b/conformance/results/mypy/directives_reveal_type.toml @@ -0,0 +1,11 @@ +conformant = "Pass" +output = """ +directives_reveal_type.py:14: note: Revealed type is "Union[builtins.int, builtins.str]" +directives_reveal_type.py:15: note: Revealed type is "builtins.list[builtins.int]" +directives_reveal_type.py:16: note: Revealed type is "Any" +directives_reveal_type.py:17: note: Revealed type is "directives_reveal_type.ForwardReference" +directives_reveal_type.py:19: error: "reveal_type" expects 1 argument [misc] +directives_reveal_type.py:19: error: Too few arguments for "reveal_type" [call-arg] +directives_reveal_type.py:20: error: "reveal_type" expects 1 argument [misc] +directives_reveal_type.py:20: error: Too many arguments for "reveal_type" [call-arg] +""" diff --git a/conformance/results/mypy/directives_type_checking.toml b/conformance/results/mypy/directives_type_checking.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/mypy/directives_type_checking.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/mypy/directives_type_ignore.toml b/conformance/results/mypy/directives_type_ignore.toml new file mode 100644 index 000000000..0657633de --- /dev/null +++ b/conformance/results/mypy/directives_type_ignore.toml @@ -0,0 +1,10 @@ +conformant = "Partial" +notes = """ +Does not honor "# type: ignore" comment if comment includes additional text. +""" +output = """ +directives_type_ignore.py:11: error: Invalid "type: ignore" comment [syntax] +directives_type_ignore.py:11: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_type_ignore.py:14: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_type_ignore.py:14: note: Error code "assignment" not covered by "type: ignore" comment +""" diff --git a/conformance/results/mypy/directives_type_ignore_file1.toml b/conformance/results/mypy/directives_type_ignore_file1.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/mypy/directives_type_ignore_file1.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/mypy/directives_type_ignore_file2.toml b/conformance/results/mypy/directives_type_ignore_file2.toml new file mode 100644 index 000000000..b5962200b --- /dev/null +++ b/conformance/results/mypy/directives_type_ignore_file2.toml @@ -0,0 +1,4 @@ +conformant = "Pass" +output = """ +directives_type_ignore_file2.py:14: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +""" diff --git a/conformance/results/mypy/directives_version_platform.toml b/conformance/results/mypy/directives_version_platform.toml new file mode 100644 index 000000000..fbc4936dc --- /dev/null +++ b/conformance/results/mypy/directives_version_platform.toml @@ -0,0 +1,11 @@ +conformant = "Pass" +notes = """ +Does not understand three-element form of sys.version checks. +Does not understand os.name checks. +""" +output = """ +directives_version_platform.py:19: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform.py:27: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform.py:40: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +directives_version_platform.py:45: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] +""" diff --git a/conformance/results/mypy/overloads_basic.toml b/conformance/results/mypy/overloads_basic.toml new file mode 100644 index 000000000..09a06cf60 --- /dev/null +++ b/conformance/results/mypy/overloads_basic.toml @@ -0,0 +1,9 @@ +conformant = "Pass" +output = """ +overloads_basic.py:37: error: No overload variant of "__getitem__" of "Bytes" matches argument type "str" [call-overload] +overloads_basic.py:37: note: Possible overload variants: +overloads_basic.py:37: note: def __getitem__(self, int, /) -> int +overloads_basic.py:37: note: def __getitem__(self, slice, /) -> bytes +overloads_basic.py:62: error: Single overload definition, multiple required [misc] +overloads_basic.py:74: error: An overloaded function outside a stub file must have an implementation [no-overload-impl] +""" diff --git a/conformance/results/mypy/protocols_class_objects.toml b/conformance/results/mypy/protocols_class_objects.toml new file mode 100644 index 000000000..897c0bb25 --- /dev/null +++ b/conformance/results/mypy/protocols_class_objects.toml @@ -0,0 +1,23 @@ +conformant = "Pass" +output = """ +protocols_class_objects.py:29: error: Only concrete class can be given where "type[Proto]" is expected [type-abstract] +protocols_class_objects.py:34: error: Can only assign concrete classes to a variable of type "type[Proto]" [type-abstract] +protocols_class_objects.py:58: error: Incompatible types in assignment (expression has type "type[ConcreteA]", variable has type "ProtoA1") [assignment] +protocols_class_objects.py:58: note: Following member(s) of "ConcreteA" have conflicts: +protocols_class_objects.py:58: note: Expected: +protocols_class_objects.py:58: note: def method1(x: int) -> int +protocols_class_objects.py:58: note: Got: +protocols_class_objects.py:58: note: def method1(self: ConcreteA, x: int) -> int +protocols_class_objects.py:74: error: Incompatible types in assignment (expression has type "type[ConcreteB]", variable has type "ProtoB1") [assignment] +protocols_class_objects.py:74: note: Following member(s) of "ConcreteB" have conflicts: +protocols_class_objects.py:74: note: prop1: expected "int", got "Callable[[ConcreteB], int]" +protocols_class_objects.py:74: note: Only class variables allowed for class object access on protocols, prop1 is an instance variable of "ConcreteB" +protocols_class_objects.py:101: error: Incompatible types in assignment (expression has type "type[ConcreteC1]", variable has type "ProtoC1") [assignment] +protocols_class_objects.py:101: note: ClassVar protocol member ProtoC1.attr1 can never be matched by a class object +protocols_class_objects.py:103: error: Incompatible types in assignment (expression has type "type[ConcreteC2]", variable has type "ProtoC1") [assignment] +protocols_class_objects.py:103: note: Only class variables allowed for class object access on protocols, attr1 is an instance variable of "ConcreteC2" +protocols_class_objects.py:103: note: ClassVar protocol member ProtoC1.attr1 can never be matched by a class object +protocols_class_objects.py:104: error: Incompatible types in assignment (expression has type "type[ConcreteC2]", variable has type "ProtoC2") [assignment] +protocols_class_objects.py:104: note: Only class variables allowed for class object access on protocols, attr1 is an instance variable of "ConcreteC2" +protocols_class_objects.py:105: error: Incompatible types in assignment (expression has type "type[ConcreteC3]", variable has type "ProtoC1") [assignment] +""" diff --git a/conformance/results/mypy/protocols_definition.toml b/conformance/results/mypy/protocols_definition.toml new file mode 100644 index 000000000..96227ab9d --- /dev/null +++ b/conformance/results/mypy/protocols_definition.toml @@ -0,0 +1,55 @@ +conformant = "Partial" +notes = """ +Rejects implicit class variable when matching protocol with explicit ClassVar. +Does not detect protocol mismatch if concrete method is missing annotations. +Does not detect protocol mismatch if concrete method's parameters are position-only. +""" +output = """ +protocols_definition.py:30: error: List item 0 has incompatible type "int"; expected "SupportsClose" [list-item] +protocols_definition.py:67: error: Protocol members cannot be defined via assignment to self [misc] +protocols_definition.py:67: error: "Template" has no attribute "temp" [attr-defined] +protocols_definition.py:114: error: Incompatible types in assignment (expression has type "Concrete2_Good2", variable has type "Template2") [assignment] +protocols_definition.py:114: note: Protocol member Template2.val1 expected class variable, got instance variable +protocols_definition.py:115: error: Incompatible types in assignment (expression has type "Concrete2_Bad1", variable has type "Template2") [assignment] +protocols_definition.py:116: error: Incompatible types in assignment (expression has type "Concrete2_Bad2", variable has type "Template2") [assignment] +protocols_definition.py:116: note: Following member(s) of "Concrete2_Bad2" have conflicts: +protocols_definition.py:116: note: val1: expected "Sequence[int]", got "Sequence[float]" +protocols_definition.py:116: note: Protocol member Template2.val1 expected class variable, got instance variable +protocols_definition.py:117: error: Incompatible types in assignment (expression has type "Concrete2_Bad3", variable has type "Template2") [assignment] +protocols_definition.py:117: note: Following member(s) of "Concrete2_Bad3" have conflicts: +protocols_definition.py:117: note: val1: expected "Sequence[int]", got "list[int]" +protocols_definition.py:117: note: Protocol member Template2.val1 expected class variable, got instance variable +protocols_definition.py:156: error: Incompatible types in assignment (expression has type "Concrete3_Bad1", variable has type "Template3") [assignment] +protocols_definition.py:157: error: Incompatible types in assignment (expression has type "Concrete3_Bad2", variable has type "Template3") [assignment] +protocols_definition.py:157: note: Protocol member Template3.val1 expected instance variable, got class variable +protocols_definition.py:158: error: Incompatible types in assignment (expression has type "Concrete3_Bad3", variable has type "Template3") [assignment] +protocols_definition.py:158: note: Protocol member Template3.val1 expected settable variable, got read-only attribute +protocols_definition.py:159: error: Incompatible types in assignment (expression has type "Concrete3_Bad4", variable has type "Template3") [assignment] +protocols_definition.py:159: note: Following member(s) of "Concrete3_Bad4" have conflicts: +protocols_definition.py:159: note: val1: expected "Sequence[int]", got "Sequence[float]" +protocols_definition.py:160: error: Incompatible types in assignment (expression has type "Concrete3_Bad5", variable has type "Template3") [assignment] +protocols_definition.py:160: note: Following member(s) of "Concrete3_Bad5" have conflicts: +protocols_definition.py:160: note: val1: expected "Sequence[int]", got "list[int]" +protocols_definition.py:218: error: Incompatible types in assignment (expression has type "Concrete4_Bad1", variable has type "Template4") [assignment] +protocols_definition.py:218: note: Following member(s) of "Concrete4_Bad1" have conflicts: +protocols_definition.py:218: note: val1: expected "Sequence[float]", got "Callable[[], Sequence[int]]" +protocols_definition.py:219: error: Incompatible types in assignment (expression has type "Concrete4_Bad2", variable has type "Template4") [assignment] +protocols_definition.py:287: error: Incompatible types in assignment (expression has type "Concrete5_Bad3", variable has type "Template5") [assignment] +protocols_definition.py:287: note: Following member(s) of "Concrete5_Bad3" have conflicts: +protocols_definition.py:287: note: Expected: +protocols_definition.py:287: note: def method1(self, a: int, b: int) -> float +protocols_definition.py:287: note: Got: +protocols_definition.py:287: note: def method1(self, *, a: int, b: int) -> float +protocols_definition.py:289: error: Incompatible types in assignment (expression has type "Concrete5_Bad5", variable has type "Template5") [assignment] +protocols_definition.py:289: note: Following member(s) of "Concrete5_Bad5" have conflicts: +protocols_definition.py:289: note: Expected: +protocols_definition.py:289: note: def method1(self, a: int, b: int) -> float +protocols_definition.py:289: note: Got: +protocols_definition.py:289: note: def method1(self: Any, a: int, b: int) -> float +protocols_definition.py:339: error: Incompatible types in assignment (expression has type "Concrete6_Bad1", variable has type "Template6") [assignment] +protocols_definition.py:339: note: Protocol member Template6.val1 expected settable variable, got read-only attribute +protocols_definition.py:340: error: Incompatible types in assignment (expression has type "Concrete6_Bad2", variable has type "Template6") [assignment] +protocols_definition.py:340: note: Protocol member Template6.val1 expected settable variable, got read-only attribute +protocols_definition.py:341: error: Incompatible types in assignment (expression has type "Concrete6_Bad3", variable has type "Template6") [assignment] +protocols_definition.py:341: note: Protocol member Template6.val1 expected settable variable, got read-only attribute +""" diff --git a/conformance/results/mypy/protocols_explicit.toml b/conformance/results/mypy/protocols_explicit.toml new file mode 100644 index 000000000..388ddbe74 --- /dev/null +++ b/conformance/results/mypy/protocols_explicit.toml @@ -0,0 +1,13 @@ +conformant = "Pass" +notes = """ +Does not report unimplemented attributes for class that explicitly derives from protocol until it is instantiated. +""" +output = """ +protocols_explicit.py:27: error: Call to abstract method "draw" of "PColor" with trivial body via super() is unsafe [safe-super] +protocols_explicit.py:56: error: Incompatible types in assignment (expression has type "tuple[int, int, str]", base class "RGB" defined the type as "tuple[int, int, int]") [assignment] +protocols_explicit.py:63: error: Cannot instantiate abstract class "Point" with abstract attributes "intensity", "other" and "transparency" [abstract] +protocols_explicit.py:92: error: Cannot instantiate abstract class "Concrete1" with abstract attributes "cm1" and "im1" [abstract] +protocols_explicit.py:114: error: Cannot instantiate abstract class "Concrete3" with abstract attributes "cm10", "cm11" and "im1" [abstract] +protocols_explicit.py:140: error: Cannot instantiate abstract class "Concrete5" with abstract attribute "method1" [abstract] +protocols_explicit.py:171: error: Cannot instantiate abstract class "Concrete7A" with abstract attribute "method1" [abstract] +""" diff --git a/conformance/results/mypy/protocols_generic.toml b/conformance/results/mypy/protocols_generic.toml new file mode 100644 index 000000000..586b695fe --- /dev/null +++ b/conformance/results/mypy/protocols_generic.toml @@ -0,0 +1,41 @@ +conformant = "Partial" +notes = """ +Fails protocol matching when method-scoped TypeVar is used in protocol. +""" +output = """ +protocols_generic.py:40: error: Incompatible types in assignment (expression has type "Concrete1", variable has type "Proto1[int, str]") [assignment] +protocols_generic.py:40: note: Following member(s) of "Concrete1" have conflicts: +protocols_generic.py:40: note: Expected: +protocols_generic.py:40: note: def __iter__(self) -> Iterator[str] +protocols_generic.py:40: note: Got: +protocols_generic.py:40: note: def __iter__(self) -> Iterator[int] +protocols_generic.py:40: note: Expected: +protocols_generic.py:40: note: def method1(self, x: int) -> int +protocols_generic.py:40: note: Got: +protocols_generic.py:40: note: def method1(self, x: str) -> str +protocols_generic.py:44: error: Only single Generic[...] or Protocol[...] can be in bases [misc] +protocols_generic.py:44: error: Duplicate type variables in Generic[...] or Protocol[...] [misc] +protocols_generic.py:56: error: Incompatible types in assignment (expression has type "Box[float]", variable has type "Box[int]") [assignment] +protocols_generic.py:66: error: Incompatible types in assignment (expression has type "Sender[int]", variable has type "Sender[float]") [assignment] +protocols_generic.py:74: error: Incompatible types in assignment (expression has type "AttrProto[int]", variable has type "AttrProto[float]") [assignment] +protocols_generic.py:75: error: Incompatible types in assignment (expression has type "AttrProto[float]", variable has type "AttrProto[int]") [assignment] +protocols_generic.py:145: error: Incompatible types in assignment (expression has type "ConcreteHasProperty2", variable has type "HasPropertyProto") [assignment] +protocols_generic.py:145: note: Following member(s) of "ConcreteHasProperty2" have conflicts: +protocols_generic.py:145: note: Expected: +protocols_generic.py:145: note: def [T] m(self, item: T, callback: Callable[[T], str]) -> str +protocols_generic.py:145: note: Got: +protocols_generic.py:145: note: def m(self, item: int, callback: Callable[[int], str]) -> str +protocols_generic.py:146: error: Incompatible types in assignment (expression has type "ConcreteHasProperty3", variable has type "HasPropertyProto") [assignment] +protocols_generic.py:146: note: Following member(s) of "ConcreteHasProperty3" have conflicts: +protocols_generic.py:146: note: f: expected "ConcreteHasProperty3", got "int" +protocols_generic.py:146: note: Expected: +protocols_generic.py:146: note: def [T] m(self, item: T, callback: Callable[[T], str]) -> str +protocols_generic.py:146: note: Got: +protocols_generic.py:146: note: def m(self, item: int, callback: Callable[[int], str]) -> str +protocols_generic.py:147: error: Incompatible types in assignment (expression has type "ConcreteHasProperty4", variable has type "HasPropertyProto") [assignment] +protocols_generic.py:147: note: Following member(s) of "ConcreteHasProperty4" have conflicts: +protocols_generic.py:147: note: Expected: +protocols_generic.py:147: note: def [T] m(self, item: T, callback: Callable[[T], str]) -> str +protocols_generic.py:147: note: Got: +protocols_generic.py:147: note: def m(self, item: str, callback: Callable[[int], str]) -> str +""" diff --git a/conformance/results/mypy/protocols_merging.toml b/conformance/results/mypy/protocols_merging.toml new file mode 100644 index 000000000..5433425a6 --- /dev/null +++ b/conformance/results/mypy/protocols_merging.toml @@ -0,0 +1,13 @@ +conformant = "Pass" +output = """ +protocols_merging.py:52: error: Incompatible types in assignment (expression has type "SCConcrete2", variable has type "SizedAndClosable1") [assignment] +protocols_merging.py:52: note: "SCConcrete2" is missing following "SizedAndClosable1" protocol member: +protocols_merging.py:52: note: __len__ +protocols_merging.py:53: error: Incompatible types in assignment (expression has type "SCConcrete2", variable has type "SizedAndClosable2") [assignment] +protocols_merging.py:53: note: "SCConcrete2" is missing following "SizedAndClosable2" protocol member: +protocols_merging.py:53: note: __len__ +protocols_merging.py:54: error: Incompatible types in assignment (expression has type "SCConcrete2", variable has type "SizedAndClosable3") [assignment] +protocols_merging.py:68: error: All bases of a protocol must be protocols [misc] +protocols_merging.py:83: error: Cannot instantiate abstract class "SizedAndClosable4" with abstract attribute "close" [abstract] +protocols_merging.py:84: error: Incompatible types in assignment (expression has type "SCConcrete1", variable has type "SizedAndClosable4") [assignment] +""" diff --git a/conformance/results/mypy/protocols_modules.toml b/conformance/results/mypy/protocols_modules.toml new file mode 100644 index 000000000..def330375 --- /dev/null +++ b/conformance/results/mypy/protocols_modules.toml @@ -0,0 +1,13 @@ +conformant = "Pass" +output = """ +protocols_modules.py:26: error: Incompatible types in assignment (expression has type Module, variable has type "Options2") [assignment] +protocols_modules.py:26: note: Following member(s) of Module "_protocols_modules1" have conflicts: +protocols_modules.py:26: note: timeout: expected "str", got "int" +protocols_modules.py:48: error: Incompatible types in assignment (expression has type Module, variable has type "Reporter2") [assignment] +protocols_modules.py:48: note: Following member(s) of Module "_protocols_modules2" have conflicts: +protocols_modules.py:48: note: Expected: +protocols_modules.py:48: note: def on_error(x: int) -> int +protocols_modules.py:48: note: Got: +protocols_modules.py:48: note: def on_error(x: int) -> None +protocols_modules.py:49: error: Incompatible types in assignment (expression has type Module, variable has type "Reporter3") [assignment] +""" diff --git a/conformance/results/mypy/protocols_recursive.toml b/conformance/results/mypy/protocols_recursive.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/mypy/protocols_recursive.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/mypy/protocols_runtime_checkable.toml b/conformance/results/mypy/protocols_runtime_checkable.toml new file mode 100644 index 000000000..b6a042ef1 --- /dev/null +++ b/conformance/results/mypy/protocols_runtime_checkable.toml @@ -0,0 +1,9 @@ +conformant = "Partial" +notes = """ +Does not report unsafe overlap for runtime_checkable protocol. +""" +output = """ +protocols_runtime_checkable.py:23: error: Only @runtime_checkable protocols can be used with instance and class checks [misc] +protocols_runtime_checkable.py:55: error: Only protocols that don't have non-method members can be used with issubclass() [misc] +protocols_runtime_checkable.py:55: note: Protocol "DataProtocol" has non-method member(s): name +""" diff --git a/conformance/results/mypy/protocols_self.toml b/conformance/results/mypy/protocols_self.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/mypy/protocols_self.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/mypy/protocols_subtyping.toml b/conformance/results/mypy/protocols_subtyping.toml new file mode 100644 index 000000000..926a57c52 --- /dev/null +++ b/conformance/results/mypy/protocols_subtyping.toml @@ -0,0 +1,12 @@ +conformant = "Pass" +output = """ +protocols_subtyping.py:16: error: Cannot instantiate protocol class "Proto1" [misc] +protocols_subtyping.py:38: error: Incompatible types in assignment (expression has type "Proto2", variable has type "Concrete2") [assignment] +protocols_subtyping.py:55: error: Incompatible types in assignment (expression has type "Proto2", variable has type "Proto3") [assignment] +protocols_subtyping.py:55: note: "Proto2" is missing following "Proto3" protocol member: +protocols_subtyping.py:55: note: method2 +protocols_subtyping.py:79: error: Incompatible types in assignment (expression has type "Proto5[int]", variable has type "Proto4[int, float]") [assignment] +protocols_subtyping.py:80: error: Incompatible types in assignment (expression has type "Proto4[int, int]", variable has type "Proto5[float]") [assignment] +protocols_subtyping.py:102: error: Incompatible types in assignment (expression has type "Proto6[float, float]", variable has type "Proto7[int, float]") [assignment] +protocols_subtyping.py:103: error: Incompatible types in assignment (expression has type "Proto6[float, float]", variable has type "Proto7[float, object]") [assignment] +""" diff --git a/conformance/results/mypy/protocols_variance.toml b/conformance/results/mypy/protocols_variance.toml new file mode 100644 index 000000000..63f5ba01b --- /dev/null +++ b/conformance/results/mypy/protocols_variance.toml @@ -0,0 +1,12 @@ +conformant = "Pass" +output = """ +protocols_variance.py:21: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc] +protocols_variance.py:40: error: Invariant type variable "T3" used in protocol where contravariant one is expected [misc] +protocols_variance.py:56: error: Invariant type variable "T1" used in protocol where contravariant one is expected [misc] +protocols_variance.py:61: error: Covariant type variable "T1_co" used in protocol where contravariant one is expected [misc] +protocols_variance.py:62: error: Cannot use a covariant type variable as a parameter [misc] +protocols_variance.py:66: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc] +protocols_variance.py:71: error: Contravariant type variable "T1_contra" used in protocol where covariant one is expected [misc] +protocols_variance.py:72: error: Cannot use a contravariant type variable as return type [misc] +protocols_variance.py:104: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc] +""" diff --git a/conformance/results/mypy/qualifiers_annotated.toml b/conformance/results/mypy/qualifiers_annotated.toml new file mode 100644 index 000000000..44adc1ec8 --- /dev/null +++ b/conformance/results/mypy/qualifiers_annotated.toml @@ -0,0 +1,26 @@ +conformant = "Partial" +notes = """ +Does not allow ClassVar to be nested within Annotated. +Does not allow Final to be nested within Annotated. +Does not allow Required and NotRequired to be nested within Annotated. +""" +output = """ +qualifiers_annotated.py:41: error: Bracketed expression "[...]" is not valid as a type [valid-type] +qualifiers_annotated.py:42: error: Syntax error in type annotation [syntax] +qualifiers_annotated.py:42: note: Suggestion: Is there a spurious trailing comma? +qualifiers_annotated.py:43: error: Invalid type comment or annotation [valid-type] +qualifiers_annotated.py:44: error: Invalid type comment or annotation [valid-type] +qualifiers_annotated.py:45: error: Invalid type comment or annotation [valid-type] +qualifiers_annotated.py:46: error: Invalid type comment or annotation [valid-type] +qualifiers_annotated.py:47: error: Invalid type comment or annotation [valid-type] +qualifiers_annotated.py:48: error: Name "var1" is not defined [name-defined] +qualifiers_annotated.py:49: error: Invalid type: try using Literal[True] instead? [valid-type] +qualifiers_annotated.py:50: error: Invalid type: try using Literal[1] instead? [valid-type] +qualifiers_annotated.py:51: error: Invalid type comment or annotation [valid-type] +qualifiers_annotated.py:52: error: Invalid type comment or annotation [valid-type] +qualifiers_annotated.py:62: error: Annotated[...] must have exactly one type argument and at least one annotation [valid-type] +qualifiers_annotated.py:73: error: Invalid type: ClassVar nested inside other type [valid-type] +qualifiers_annotated.py:75: error: Final can be only used as an outermost qualifier in a variable annotation [valid-type] +qualifiers_annotated.py:85: error: Required[] can be only used in a TypedDict definition [valid-type] +qualifiers_annotated.py:87: error: NotRequired[] can be only used in a TypedDict definition [valid-type] +""" diff --git a/conformance/results/mypy/qualifiers_final_annotation.toml b/conformance/results/mypy/qualifiers_final_annotation.toml new file mode 100644 index 000000000..f5295752e --- /dev/null +++ b/conformance/results/mypy/qualifiers_final_annotation.toml @@ -0,0 +1,38 @@ +conformant = "Partial" +notes = """ +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. +""" +output = """ +qualifiers_final_annotation.py:16: error: Type in Final[...] can only be omitted if there is an initializer [misc] +qualifiers_final_annotation.py:18: error: Final[...] takes at most one type argument [misc] +qualifiers_final_annotation.py:34: error: Type in Final[...] can only be omitted if there is an initializer [misc] +qualifiers_final_annotation.py:38: error: Final name must be initialized with a value [misc] +qualifiers_final_annotation.py:54: error: Cannot assign to final attribute "ID5" [misc] +qualifiers_final_annotation.py:59: error: Cannot assign to final attribute "ID6" [misc] +qualifiers_final_annotation.py:62: error: Can only declare a final attribute in class body or __init__ [misc] +qualifiers_final_annotation.py:63: error: Can only declare a final attribute in class body or __init__ [misc] +qualifiers_final_annotation.py:65: error: Cannot assign to final attribute "ID7" [misc] +qualifiers_final_annotation.py:67: error: Cannot assign to final attribute "ID7" [misc] +qualifiers_final_annotation.py:71: error: Cannot assign to final name "RATE" [misc] +qualifiers_final_annotation.py:81: error: Cannot assign to final attribute "DEFAULT_ID" [misc] +qualifiers_final_annotation.py:94: error: Cannot assign to final name "BORDER_WIDTH" [misc] +qualifiers_final_annotation.py:96: error: Cannot assign to final name "__private" [misc] +qualifiers_final_annotation.py:107: error: Final can be only used as an outermost qualifier in a variable annotation [valid-type] +qualifiers_final_annotation.py:108: error: Variable should not be annotated with both ClassVar and Final [misc] +qualifiers_final_annotation.py:118: error: Final can be only used as an outermost qualifier in a variable annotation [valid-type] +qualifiers_final_annotation.py:121: error: Final can be only used as an outermost qualifier in a variable annotation [valid-type] +qualifiers_final_annotation.py:131: error: Invalid "NamedTuple()" field name [misc] +qualifiers_final_annotation.py:133: error: Unexpected keyword argument "x" for "N" [call-arg] +qualifiers_final_annotation.py:133: error: Unexpected keyword argument "y" for "N" [call-arg] +qualifiers_final_annotation.py:134: error: Unexpected keyword argument "a" for "N" [call-arg] +qualifiers_final_annotation.py:135: error: Unexpected keyword argument "x" for "N" [call-arg] +qualifiers_final_annotation.py:135: error: Unexpected keyword argument "y" for "N" [call-arg] +qualifiers_final_annotation.py:141: error: Cannot assign to final name "ID1" [misc] +qualifiers_final_annotation.py:145: error: Cannot assign to final name "x" [misc] +qualifiers_final_annotation.py:147: error: Cannot assign to final name "x" [misc] +qualifiers_final_annotation.py:152: error: Incompatible types in assignment (expression has type "TextIOWrapper", variable has type "int") [assignment] +qualifiers_final_annotation.py:155: error: Cannot assign to final name "x" [misc] +""" diff --git a/conformance/results/mypy/qualifiers_final_decorator.toml b/conformance/results/mypy/qualifiers_final_decorator.toml new file mode 100644 index 000000000..114785bd1 --- /dev/null +++ b/conformance/results/mypy/qualifiers_final_decorator.toml @@ -0,0 +1,18 @@ +conformant = "Pass" +output = """ +qualifiers_final_decorator.py:21: error: Cannot inherit from final class "Base1" [misc] +qualifiers_final_decorator.py:56: error: Cannot override final attribute "method1" (previously declared in base class "Base2") [misc] +qualifiers_final_decorator.py:59: error: Cannot override final attribute "method2" (previously declared in base class "Base2") [misc] +qualifiers_final_decorator.py:63: error: Cannot override final attribute "method3" (previously declared in base class "Base2") [misc] +qualifiers_final_decorator.py:67: error: Cannot override final attribute "method4" (previously declared in base class "Base2") [misc] +qualifiers_final_decorator.py:80: error: Cannot override final attribute "method" (previously declared in base class "Base3") [misc] +qualifiers_final_decorator.py:84: error: @final should be applied only to overload implementation [misc] +qualifiers_final_decorator.py:94: error: Cannot override final attribute "method" (previously declared in base class "Base4") [misc] +qualifiers_final_decorator.py:118: error: Cannot override final attribute "method" (previously declared in base class "Base5_2") [misc] +qualifiers_final_decorator.py:118: error: Signature of "method" incompatible with supertype "Base5_2" [override] +qualifiers_final_decorator.py:118: note: Superclass: +qualifiers_final_decorator.py:118: note: def method(self, v: int) -> None +qualifiers_final_decorator.py:118: note: Subclass: +qualifiers_final_decorator.py:118: note: def method(self) -> None +qualifiers_final_decorator.py:125: error: @final cannot be used with non-method functions [misc] +""" diff --git a/conformance/results/mypy/specialtypes_any.toml b/conformance/results/mypy/specialtypes_any.toml new file mode 100644 index 000000000..d79075e53 --- /dev/null +++ b/conformance/results/mypy/specialtypes_any.toml @@ -0,0 +1,5 @@ +conformant = "Pass" +output = """ +specialtypes_any.py:37: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked] +specialtypes_any.py:38: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked] +""" diff --git a/conformance/results/mypy/specialtypes_never.toml b/conformance/results/mypy/specialtypes_never.toml new file mode 100644 index 000000000..6fa559923 --- /dev/null +++ b/conformance/results/mypy/specialtypes_never.toml @@ -0,0 +1,11 @@ +conformant = "Partial" +notes = """ +Does not reject NoReturn when used outside of return type annotation. +""" +output = """ +specialtypes_never.py:19: error: Implicit return in function which does not return [misc] +specialtypes_never.py:85: error: Incompatible types in assignment (expression has type "list[NoReturn]", variable has type "list[int]") [assignment] +specialtypes_never.py:85: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance +specialtypes_never.py:85: note: Consider using "Sequence" instead, which is covariant +specialtypes_never.py:104: error: Incompatible return value type (got "ClassC[NoReturn]", expected "ClassC[U]") [return-value] +""" diff --git a/conformance/results/mypy/specialtypes_none.toml b/conformance/results/mypy/specialtypes_none.toml new file mode 100644 index 000000000..3730e8547 --- /dev/null +++ b/conformance/results/mypy/specialtypes_none.toml @@ -0,0 +1,6 @@ +conformant = "Pass" +output = """ +specialtypes_none.py:21: error: Argument 1 to "func1" has incompatible type "type[None]"; expected "None" [arg-type] +specialtypes_none.py:27: error: Incompatible types in assignment (expression has type "None", variable has type "Iterable[Any]") [assignment] +specialtypes_none.py:41: error: Argument 1 to "func2" has incompatible type "None"; expected "type[None]" [arg-type] +""" diff --git a/conformance/results/mypy/specialtypes_promotions.toml b/conformance/results/mypy/specialtypes_promotions.toml new file mode 100644 index 000000000..60e34faf9 --- /dev/null +++ b/conformance/results/mypy/specialtypes_promotions.toml @@ -0,0 +1,4 @@ +conformant = "Pass" +output = """ +specialtypes_promotions.py:13: error: "float" has no attribute "numerator" [attr-defined] +""" diff --git a/conformance/results/mypy/specialtypes_tuple.toml b/conformance/results/mypy/specialtypes_tuple.toml new file mode 100644 index 000000000..d7a670bd8 --- /dev/null +++ b/conformance/results/mypy/specialtypes_tuple.toml @@ -0,0 +1,10 @@ +conformant = "Pass" +output = """ +specialtypes_tuple.py:12: error: Incompatible types in assignment (expression has type "tuple[int, int]", variable has type "tuple[int]") [assignment] +specialtypes_tuple.py:14: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "tuple[int, int]") [assignment] +specialtypes_tuple.py:15: error: Incompatible types in assignment (expression has type "tuple[int, str]", variable has type "tuple[int, int]") [assignment] +specialtypes_tuple.py:25: error: Incompatible types in assignment (expression has type "tuple[int]", variable has type "tuple[()]") [assignment] +specialtypes_tuple.py:36: error: Incompatible types in assignment (expression has type "tuple[int, int, int, str]", variable has type "tuple[int, ...]") [assignment] +specialtypes_tuple.py:42: error: Incompatible types in assignment (expression has type "tuple[int, ...]", variable has type "tuple[int]") [assignment] +specialtypes_tuple.py:43: error: Incompatible types in assignment (expression has type "tuple[int, ...]", variable has type "tuple[()]") [assignment] +""" diff --git a/conformance/results/mypy/specialtypes_tuple_unpack.toml b/conformance/results/mypy/specialtypes_tuple_unpack.toml new file mode 100644 index 000000000..0d497bf3a --- /dev/null +++ b/conformance/results/mypy/specialtypes_tuple_unpack.toml @@ -0,0 +1,14 @@ +conformant = "Pass" +output = """ +specialtypes_tuple_unpack.py: error: More than one Unpack in a type is not allowed [misc] +specialtypes_tuple_unpack.py:7: error: Incompatible types in assignment (expression has type "tuple[int, str, str]", variable has type "tuple[int, str]") [assignment] +specialtypes_tuple_unpack.py:12: error: Incompatible types in assignment (expression has type "tuple[int, int, str]", variable has type "tuple[int, *tuple[str, ...]]") [assignment] +specialtypes_tuple_unpack.py:13: error: Incompatible types in assignment (expression has type "tuple[int, str, int]", variable has type "tuple[int, *tuple[str, ...]]") [assignment] +specialtypes_tuple_unpack.py:19: error: Incompatible types in assignment (expression has type "tuple[int, str, str]", variable has type "tuple[int, *tuple[str, ...], int]") [assignment] +specialtypes_tuple_unpack.py:20: error: Incompatible types in assignment (expression has type "tuple[int, str, str, float]", variable has type "tuple[int, *tuple[str, ...], int]") [assignment] +specialtypes_tuple_unpack.py:25: error: Incompatible types in assignment (expression has type "tuple[int, str, int]", variable has type "tuple[*tuple[str, ...], int]") [assignment] +specialtypes_tuple_unpack.py:26: error: Incompatible types in assignment (expression has type "tuple[str, str, float]", variable has type "tuple[*tuple[str, ...], int]") [assignment] +specialtypes_tuple_unpack.py:34: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[str, str, int]") [assignment] +specialtypes_tuple_unpack.py:37: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[str, str, str, *tuple[str, ...]]") [assignment] +specialtypes_tuple_unpack.py:41: error: Incompatible types in assignment (expression has type "tuple[str, str]", variable has type "tuple[*tuple[str, ...], str, str, str]") [assignment] +""" diff --git a/conformance/results/mypy/specialtypes_type.toml b/conformance/results/mypy/specialtypes_type.toml new file mode 100644 index 000000000..474c3e4a4 --- /dev/null +++ b/conformance/results/mypy/specialtypes_type.toml @@ -0,0 +1,20 @@ +conformant = "Partial" +notes = """ +Does not treat `type` same as `type[Any]` for assert_type. +Does not allow access to unknown attributes from object of type `type[Any]`. +""" +output = """ +specialtypes_type.py:56: error: Argument 1 to "func4" has incompatible type "type[TeamUser]"; expected "type[BasicUser] | type[ProUser]" [arg-type] +specialtypes_type.py:70: error: Argument 1 to "func5" has incompatible type ""; expected "type[Never]" [arg-type] +specialtypes_type.py:76: error: type[...] must have exactly one type argument [valid-type] +specialtypes_type.py:84: error: Expression is of type "type", not "type[Any]" [assert-type] +specialtypes_type.py:99: error: "type" has no attribute "unknown" [attr-defined] +specialtypes_type.py:100: error: "type" has no attribute "unknown" [attr-defined] +specialtypes_type.py:117: error: "type[object]" has no attribute "unknown" [attr-defined] +specialtypes_type.py:120: error: "type[object]" has no attribute "unknown" [attr-defined] +specialtypes_type.py:139: error: Expression is of type "type", not "type[Any]" [assert-type] +specialtypes_type.py:143: error: "" has no attribute "unknown" [attr-defined] +specialtypes_type.py:144: error: "" has no attribute "unknown" [attr-defined] +specialtypes_type.py:145: error: "type[type]" has no attribute "unknown" [attr-defined] +specialtypes_type.py:146: error: "" has no attribute "unknown" [attr-defined] +""" diff --git a/conformance/results/mypy/typeddicts_alt_syntax.toml b/conformance/results/mypy/typeddicts_alt_syntax.toml index bb1da440f..8d540eb0f 100644 --- a/conformance/results/mypy/typeddicts_alt_syntax.toml +++ b/conformance/results/mypy/typeddicts_alt_syntax.toml @@ -1,4 +1,4 @@ -conformant = "Partial" +conformant = "Pass" notes = """ Does not support keyword-argument form of alternative syntax (deprecated in 3.11). """ diff --git a/conformance/results/mypy/version.toml b/conformance/results/mypy/version.toml index 63c2f4d79..1842b0d7a 100644 --- a/conformance/results/mypy/version.toml +++ b/conformance/results/mypy/version.toml @@ -1,2 +1,2 @@ version = "mypy 1.8.0" -test_duration = 0.3814089298248291 +test_duration = 0.6594910621643066 diff --git a/conformance/results/pyre/annotations_coroutines.toml b/conformance/results/pyre/annotations_coroutines.toml new file mode 100644 index 000000000..b04dee644 --- /dev/null +++ b/conformance/results/pyre/annotations_coroutines.toml @@ -0,0 +1,7 @@ +conformant = "Partial" +notes = """ +Does not evaluate correct type for async function. +""" +output = """ +annotations_coroutines.py:19:45 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Tuple[Type[Variable[_T_co](covariant)], Type[Variable[_T_contra](contravariant)], Type[Variable[_V_co](covariant)]]` but got `Tuple[object, object, Type[str]]`. +""" diff --git a/conformance/results/pyre/annotations_forward_refs.toml b/conformance/results/pyre/annotations_forward_refs.toml new file mode 100644 index 000000000..3a88c0b03 --- /dev/null +++ b/conformance/results/pyre/annotations_forward_refs.toml @@ -0,0 +1,28 @@ +conformant = "Partial" +notes = """ +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). +Does not reject f-string in quoted type annotation. +Incorrectly generates error for quoted type defined in class scope. +Does not generate error for unquoted type defined in class scope. +""" +output = """ +annotations_forward_refs.py:19:25 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T]]` but got `UnionType`. +annotations_forward_refs.py:41:8 Undefined or invalid type [11]: Annotation `eval(.join(map(chr, [105, 110, 116])))` is not defined as a type. +annotations_forward_refs.py:42:8 Invalid type [31]: Expression `"[int, str]"` is not a valid type. +annotations_forward_refs.py:43:8 Invalid type [31]: Expression `"(int, str)"` is not a valid type. +annotations_forward_refs.py:44:8 Undefined or invalid type [11]: Annotation `comprehension(int for generators(generator($target$i in range(1) if )))` is not defined as a type. +annotations_forward_refs.py:45:8 Invalid type [31]: Expression `"{ }"` is not a valid type. +annotations_forward_refs.py:46:8 Undefined or invalid type [11]: Annotation `lambda () (int)()` is not defined as a type. +annotations_forward_refs.py:47:8 Invalid type [31]: Expression `[int][0]` is not a valid type. +annotations_forward_refs.py:48:8 Invalid type [31]: Expression `"int if 1 < 3 else str"` is not a valid type. +annotations_forward_refs.py:49:8 Undefined or invalid type [11]: Annotation `var1` is not defined as a type. +annotations_forward_refs.py:50:9 Invalid type [31]: Expression `"True"` is not a valid type. +annotations_forward_refs.py:51:9 Invalid type [31]: Expression `"1"` is not a valid type. +annotations_forward_refs.py:52:9 Invalid type [31]: Expression `"-1"` is not a valid type. +annotations_forward_refs.py:53:9 Invalid type [31]: Expression `"int or str"` is not a valid type. +annotations_forward_refs.py:55:9 Undefined or invalid type [11]: Annotation `types` is not defined as a type. +annotations_forward_refs.py:77:0 Uninitialized attribute [13]: Attribute `ClassC` is declared in class `ClassD` to have type `ClassC` but is never initialized. +annotations_forward_refs.py:80:12 Undefined or invalid type [11]: Annotation `ClassF` is not defined as a type. +annotations_forward_refs.py:87:7 Undefined or invalid type [11]: Annotation `ClassD.int` is not defined as a type. +""" diff --git a/conformance/results/pyre/annotations_generators.toml b/conformance/results/pyre/annotations_generators.toml new file mode 100644 index 000000000..48bda1ea9 --- /dev/null +++ b/conformance/results/pyre/annotations_generators.toml @@ -0,0 +1,22 @@ +conformant = "Partial" +notes = """ +Does not report invalid return type for generator when function implicitly returns None. +Incorrectly evaluates type of call to async generator. +""" +output = """ +annotations_generators.py:54:8 Incompatible return type [7]: Expected `Generator[A, B, C]` but got `Generator[typing.Any, typing.Any, bool]`. +annotations_generators.py:57:8 Incompatible return type [7]: Expected `Generator[A, B, C]` but got `Generator[int, typing.Any, typing.Any]`. +annotations_generators.py:66:8 Incompatible return type [7]: Expected `Generator[A, int, typing.Any]` but got `Generator[int, typing.Any, typing.Any]`. +annotations_generators.py:75:4 Incompatible return type [7]: Expected `Iterator[A]` but got `Generator[B, typing.Any, typing.Any]`. +annotations_generators.py:87:4 Incompatible return type [7]: Expected `int` but got `Generator[None, typing.Any, typing.Any]`. +annotations_generators.py:88:4 Incompatible return type [7]: Expected `int` but got `Generator[typing.Any, typing.Any, int]`. +annotations_generators.py:91:0 Incompatible async generator return type [57]: Expected return annotation to be AsyncGenerator or a superclass but got `int`. +annotations_generators.py:92:4 Incompatible return type [7]: Expected `int` but got `AsyncGenerator[None, typing.Any]`. +annotations_generators.py:118:4 Incompatible return type [7]: Expected `Iterator[B]` but got `Generator[A, None, typing.Any]`. +annotations_generators.py:119:4 Incompatible return type [7]: Expected `Iterator[B]` but got `Generator[int, None, typing.Any]`. +annotations_generators.py:135:4 Incompatible return type [7]: Expected `Generator[None, str, None]` but got `Generator[None, int, typing.Any]`. +annotations_generators.py:167:35 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Tuple[Type[Variable[_T_co](covariant)], Type[Variable[_T_contra](contravariant)]]` but got `Tuple[Type[str], None]`. +annotations_generators.py:174:35 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Tuple[Type[Variable[_T_co](covariant)], Type[Variable[_T_contra](contravariant)]]` but got `Tuple[Type[str], None]`. +annotations_generators.py:182:48 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Tuple[Type[Variable[_T_co](covariant)], Type[Variable[_T_contra](contravariant)], Type[Variable[_V_co](covariant)]]` but got `Tuple[object, object, typing.Any]`. +annotations_generators.py:182:58 Undefined attribute [16]: `AsyncIterator` has no attribute `__getitem__`. +""" diff --git a/conformance/results/pyre/annotations_methods.toml b/conformance/results/pyre/annotations_methods.toml new file mode 100644 index 000000000..d93e17525 --- /dev/null +++ b/conformance/results/pyre/annotations_methods.toml @@ -0,0 +1,6 @@ +conformant = "Pass" +notes = """ +Type evaluation differs from other type checkers because of ambiguity in the spec related to method bindings. +""" +output = """ +""" diff --git a/conformance/results/pyre/annotations_typeexpr.toml b/conformance/results/pyre/annotations_typeexpr.toml index 86bc19108..c1cb1b406 100644 --- a/conformance/results/pyre/annotations_typeexpr.toml +++ b/conformance/results/pyre/annotations_typeexpr.toml @@ -1,19 +1,20 @@ conformant = "Pass" output = """ -annotations_typeexpr.py:65:26 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T]]` but got `object`. -annotations_typeexpr.py:67:27 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T_co](covariant)]` but got `Tuple[object, typing.Any]`. -annotations_typeexpr.py:77:8 Invalid type [31]: Expression `eval("".join(map(chr, [105, 110, 116])))` is not a valid type. -annotations_typeexpr.py:78:8 Invalid type [31]: Expression `[int, str]` is not a valid type. -annotations_typeexpr.py:79:8 Invalid type [31]: Expression `(int, str)` is not a valid type. -annotations_typeexpr.py:80:8 Invalid type [31]: Expression `comprehension(int for generators(generator($target$i in range(1) if )))` is not a valid type. -annotations_typeexpr.py:81:8 Invalid type [31]: Expression `{ }` is not a valid type. -annotations_typeexpr.py:82:8 Invalid type [31]: Expression `lambda () (int)()` is not a valid type. -annotations_typeexpr.py:83:8 Invalid type [31]: Expression `[int][0]` is not a valid type. -annotations_typeexpr.py:84:8 Invalid type [31]: Expression `int if 1 < 3 else str` is not a valid type. -annotations_typeexpr.py:85:8 Undefined or invalid type [11]: Annotation `var1` is not defined as a type. -annotations_typeexpr.py:86:9 Invalid type [31]: Expression `True` is not a valid type. -annotations_typeexpr.py:87:9 Invalid type [31]: Expression `1` is not a valid type. -annotations_typeexpr.py:88:9 Invalid type [31]: Expression `-1` is not a valid type. -annotations_typeexpr.py:89:9 Invalid type [31]: Expression `int or str` is not a valid type. -annotations_typeexpr.py:90:9 Invalid type [31]: Expression `"int"` is not a valid type. +annotations_typeexpr.py:75:26 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T]]` but got `object`. +annotations_typeexpr.py:77:27 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T_co](covariant)]` but got `Tuple[object, typing.Any]`. +annotations_typeexpr.py:88:8 Invalid type [31]: Expression `eval("".join(map(chr, [105, 110, 116])))` is not a valid type. +annotations_typeexpr.py:89:8 Invalid type [31]: Expression `[int, str]` is not a valid type. +annotations_typeexpr.py:90:8 Invalid type [31]: Expression `(int, str)` is not a valid type. +annotations_typeexpr.py:91:8 Invalid type [31]: Expression `comprehension(int for generators(generator($target$i in range(1) if )))` is not a valid type. +annotations_typeexpr.py:92:8 Invalid type [31]: Expression `{ }` is not a valid type. +annotations_typeexpr.py:93:8 Invalid type [31]: Expression `lambda () (int)()` is not a valid type. +annotations_typeexpr.py:94:8 Invalid type [31]: Expression `[int][0]` is not a valid type. +annotations_typeexpr.py:95:8 Invalid type [31]: Expression `int if 1 < 3 else str` is not a valid type. +annotations_typeexpr.py:96:8 Undefined or invalid type [11]: Annotation `var1` is not defined as a type. +annotations_typeexpr.py:97:9 Invalid type [31]: Expression `True` is not a valid type. +annotations_typeexpr.py:98:9 Invalid type [31]: Expression `1` is not a valid type. +annotations_typeexpr.py:99:9 Invalid type [31]: Expression `-1` is not a valid type. +annotations_typeexpr.py:100:9 Invalid type [31]: Expression `int or str` is not a valid type. +annotations_typeexpr.py:101:9 Invalid type [31]: Expression `"int"` is not a valid type. +annotations_typeexpr.py:102:9 Undefined or invalid type [11]: Annotation `types` is not defined as a type. """ diff --git a/conformance/results/pyre/classes_classvar.toml b/conformance/results/pyre/classes_classvar.toml new file mode 100644 index 000000000..af8bcfde2 --- /dev/null +++ b/conformance/results/pyre/classes_classvar.toml @@ -0,0 +1,27 @@ +conformant = "Partial" +notes = """ +Does not reject use of TypeVar in ClassVar. +Does not reject use of ParamSpec in ClassVar. +Does not reject use of ClassVar as a generic type argument. +Does not reject use of ClassVar in parameter type annotation. +Does not reject use of ClassVar in local variable annotation. +Does not reject use of ClassVar in instance variable annotation. +Does not reject use of ClassVar in return type annotation. +Does not reject use of ClassVar in type alias definition. +""" +output = """ +classes_classvar.py:33:0 Uninitialized attribute [13]: Attribute `bad1` is declared in class `ClassA` to have type `typing.Any` but is never initialized. +classes_classvar.py:33:0 Uninitialized attribute [13]: Attribute `bad4` is declared in class `ClassA` to have type `Variable[T]` but is never initialized. +classes_classvar.py:33:0 Uninitialized attribute [13]: Attribute `bad5` is declared in class `ClassA` to have type `typing.List[Variable[T]]` but is never initialized. +classes_classvar.py:33:0 Uninitialized attribute [13]: Attribute `bad6` is declared in class `ClassA` to have type `typing.Callable[classes_classvar.P, typing.Any]` but is never initialized. +classes_classvar.py:36:10 Invalid type parameters [24]: Generic type `CV` expects 1 type parameter, received 2. +classes_classvar.py:37:10 Invalid type [31]: Expression `typing.ClassVar[3]` is not a valid type. +classes_classvar.py:38:13 Unbound name [10]: Name `var` is used but not defined in the current scope. +classes_classvar.py:50:4 Incompatible attribute type [8]: Attribute `bad8` declared in class `ClassA` has type `List[str]` but is used as type `Dict[Variable[_KT], Variable[_VT]]`. +classes_classvar.py:52:10 Unbound name [10]: Name `Final` is used but not defined in the current scope. +classes_classvar.py:63:8 Undefined attribute [16]: `ClassA` has no attribute `xx`. +classes_classvar.py:66:8 Incompatible return type [7]: Expected `CV[int]` but got `int`. +classes_classvar.py:79:0 Uninitialized attribute [13]: Attribute `damage` is declared in class `BasicStarship` to have type `int` but is never initialized. +classes_classvar.py:100:0 Invalid assignment [41]: Assigning to class variable through instance, did you mean to assign to `Starship.stats` instead? +classes_classvar.py:129:0 Incompatible variable type [9]: a is declared to have type `ProtoA` but is used as type `ProtoAImpl`. +""" diff --git a/conformance/results/pyre/classes_override.toml b/conformance/results/pyre/classes_override.toml new file mode 100644 index 000000000..0ba1e9365 --- /dev/null +++ b/conformance/results/pyre/classes_override.toml @@ -0,0 +1,22 @@ +conformant = "Unsupported" +notes = """ +Does not yet support the @override decorator. +""" +output = """ +classes_override.py:7:0 Undefined import [21]: Could not find a name `override` defined in module `typing`. +classes_override.py:37:5 Undefined attribute [16]: Module `typing` has no attribute `override`. +classes_override.py:52:5 Undefined attribute [16]: Module `typing` has no attribute `override`. +classes_override.py:53:4 Invalid override [40]: `classes_override.ChildA.method3` is decorated with @override, but no method of the same name exists in superclasses of `ChildA`. +classes_override.py:64:5 Undefined attribute [16]: Module `typing` has no attribute `override`. +classes_override.py:65:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +classes_override.py:65:4 Invalid override [40]: `classes_override.ChildA.method4` is decorated with @override, but no method of the same name exists in superclasses of `ChildA`. +classes_override.py:78:5 Undefined attribute [16]: Module `typing` has no attribute `override`. +classes_override.py:79:4 Invalid override [40]: `classes_override.ChildA.static_method1` is decorated with @override, but no method of the same name exists in superclasses of `ChildA`. +classes_override.py:83:5 Undefined attribute [16]: Module `typing` has no attribute `override`. +classes_override.py:84:4 Invalid override [40]: `classes_override.ChildA.class_method1` is decorated with @override, but no method of the same name exists in superclasses of `ChildA`. +classes_override.py:90:5 Undefined attribute [16]: Module `typing` has no attribute `override`. +classes_override.py:91:4 Invalid override [40]: `classes_override.ChildA.property1` is decorated with @override, but no method of the same name exists in superclasses of `ChildA`. +classes_override.py:97:14 Invalid inheritance [39]: `typing.Any` is not a valid parent class. +classes_override.py:102:5 Undefined attribute [16]: Module `typing` has no attribute `override`. +classes_override.py:103:4 Invalid override [40]: `classes_override.ChildB.method1` is decorated with @override, but no method of the same name exists in superclasses of `ChildB`. +""" diff --git a/conformance/results/pyre/directives_assert_type.toml b/conformance/results/pyre/directives_assert_type.toml new file mode 100644 index 000000000..b83af4108 --- /dev/null +++ b/conformance/results/pyre/directives_assert_type.toml @@ -0,0 +1,8 @@ +conformant = "Unsupported" +notes = """ +Does not understand "assert_type". +""" +output = """ +directives_assert_type.py:31:4 Missing argument [20]: Call `assert_type` expects argument in position 0. +directives_assert_type.py:33:4 Too many arguments [19]: Call `assert_type` expects 2 positional arguments, 3 were provided. +""" diff --git a/conformance/results/pyre/directives_cast.toml b/conformance/results/pyre/directives_cast.toml new file mode 100644 index 000000000..cbb4ea201 --- /dev/null +++ b/conformance/results/pyre/directives_cast.toml @@ -0,0 +1,6 @@ +conformant = "Pass" +output = """ +directives_cast.py:15:7 Missing argument [20]: Call `cast` expects argument `typ`. +directives_cast.py:16:12 Invalid type [31]: Expression `1` is not a valid type. +directives_cast.py:17:7 Too many arguments [19]: Call `cast` expects 2 positional arguments, 3 were provided. +""" diff --git a/conformance/results/pyre/directives_no_type_check.toml b/conformance/results/pyre/directives_no_type_check.toml new file mode 100644 index 000000000..639a79cb5 --- /dev/null +++ b/conformance/results/pyre/directives_no_type_check.toml @@ -0,0 +1,11 @@ +conformant = "Unsupported" +notes = """ +Does not honor @no_type_check decorator. +""" +output = """ +directives_no_type_check.py:16:12 Unsupported operand [58]: `+` is not supported for operand types `int` and `str`. +directives_no_type_check.py:17:4 Incompatible return type [7]: Expected `None` but got `int`. +directives_no_type_check.py:20:6 Incompatible parameter type [6]: In call `func1`, for 1st positional argument, expected `int` but got `bytes`. +directives_no_type_check.py:20:18 Incompatible parameter type [6]: In call `func1`, for 2nd positional argument, expected `str` but got `bytes`. +directives_no_type_check.py:21:0 Missing argument [20]: Call `func1` expects argument `a`. +""" diff --git a/conformance/results/pyre/directives_reveal_type.toml b/conformance/results/pyre/directives_reveal_type.toml new file mode 100644 index 000000000..fe33115be --- /dev/null +++ b/conformance/results/pyre/directives_reveal_type.toml @@ -0,0 +1,8 @@ +conformant = "Unsupported" +notes = """ +Does not understand reveal_type call. +""" +output = """ +directives_reveal_type.py:19:4 Missing argument [20]: Call `reveal_type` expects argument in position 0. +directives_reveal_type.py:20:4 Too many arguments [19]: Call `reveal_type` expects 1 positional argument, 2 were provided. +""" diff --git a/conformance/results/pyre/directives_type_checking.toml b/conformance/results/pyre/directives_type_checking.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/pyre/directives_type_checking.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/pyre/directives_type_ignore.toml b/conformance/results/pyre/directives_type_ignore.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/pyre/directives_type_ignore.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/pyre/directives_type_ignore_file1.toml b/conformance/results/pyre/directives_type_ignore_file1.toml new file mode 100644 index 000000000..2dc002af4 --- /dev/null +++ b/conformance/results/pyre/directives_type_ignore_file1.toml @@ -0,0 +1,7 @@ +conformant = "Unsupported" +notes = """ +Does not support file-level `#type: ignore` comment. +""" +output = """ +directives_type_ignore_file1.py:16:0 Incompatible variable type [9]: x is declared to have type `int` but is used as type `str`. +""" diff --git a/conformance/results/pyre/directives_type_ignore_file2.toml b/conformance/results/pyre/directives_type_ignore_file2.toml new file mode 100644 index 000000000..dba9f5dd6 --- /dev/null +++ b/conformance/results/pyre/directives_type_ignore_file2.toml @@ -0,0 +1,4 @@ +conformant = "Pass" +output = """ +directives_type_ignore_file2.py:14:0 Incompatible variable type [9]: x is declared to have type `int` but is used as type `str`. +""" diff --git a/conformance/results/pyre/directives_version_platform.toml b/conformance/results/pyre/directives_version_platform.toml new file mode 100644 index 000000000..f8f4a8d02 --- /dev/null +++ b/conformance/results/pyre/directives_version_platform.toml @@ -0,0 +1,11 @@ +conformant = "Partial" +notes = """ +Does not support sys.platform checks. +Does not support os.name checks. +""" +output = """ +directives_version_platform.py:31:4 Incompatible variable type [9]: val5 is declared to have type `int` but is used as type `str`. +directives_version_platform.py:36:4 Incompatible variable type [9]: val6 is declared to have type `int` but is used as type `str`. +directives_version_platform.py:40:4 Incompatible variable type [9]: val7 is declared to have type `int` but is used as type `str`. +directives_version_platform.py:45:4 Incompatible variable type [9]: val8 is declared to have type `int` but is used as type `str`. +""" diff --git a/conformance/results/pyre/overloads_basic.toml b/conformance/results/pyre/overloads_basic.toml new file mode 100644 index 000000000..0dd93e644 --- /dev/null +++ b/conformance/results/pyre/overloads_basic.toml @@ -0,0 +1,8 @@ +conformant = "Partial" +notes = """ +Does not reject a function with a single @overload signature. +""" +output = """ +overloads_basic.py:37:2 Incompatible parameter type [6]: In call `Bytes.__getitem__`, for 1st positional argument, expected `int` but got `str`. +overloads_basic.py:75:0 Missing overload implementation [42]: Overloaded function `func2` must have an implementation. +""" diff --git a/conformance/results/pyre/protocols_class_objects.toml b/conformance/results/pyre/protocols_class_objects.toml new file mode 100644 index 000000000..f4831c929 --- /dev/null +++ b/conformance/results/pyre/protocols_class_objects.toml @@ -0,0 +1,12 @@ +conformant = "Partial" +notes = """ +Does not reject protocol class assigned to type[Proto]. +Incorrectly reports some class objects as incompatible with a protocol. +Fails to report some class objects as incompatible with a protocol. +""" +output = """ +protocols_class_objects.py:26:11 Invalid class instantiation [45]: Cannot instantiate abstract class `Proto` with abstract method `meth`. +protocols_class_objects.py:58:0 Incompatible variable type [9]: pa1 is declared to have type `ProtoA1` but is used as type `Type[ConcreteA]`. +protocols_class_objects.py:59:0 Incompatible variable type [9]: pa2 is declared to have type `ProtoA2` but is used as type `Type[ConcreteA]`. +protocols_class_objects.py:93:0 Uninitialized attribute [13]: Attribute `attr1` is declared in class `CMeta` to have type `int` but is never initialized. +""" diff --git a/conformance/results/pyre/protocols_definition.toml b/conformance/results/pyre/protocols_definition.toml new file mode 100644 index 000000000..3f95938f1 --- /dev/null +++ b/conformance/results/pyre/protocols_definition.toml @@ -0,0 +1,24 @@ +conformant = "Partial" +notes = """ +Does not reject ClassVar in concrete class when attribute in protocol is not ClassVar. +Does not reject read-only property in concrete class when attribute in protocol is mutable. +Does not reject covariant attribute type when protocol attribute is mutable. +Does not reject read-only property in concrete class when protocol has settable property. +Does not reject immutable named tuple attribute in concrete class when protocol attribute is mutable. +Does not reject immutable frozen dataclass attribute in concrete class when protocol attribute is mutable. +""" +output = """ +protocols_definition.py:30:10 Incompatible parameter type [6]: In call `close_all`, for 1st positional argument, expected `Iterable[SupportsClose]` but got `Iterable[int]`. +protocols_definition.py:67:8 Undefined attribute [16]: `Template` has no attribute `temp`. +protocols_definition.py:115:0 Incompatible variable type [9]: v2_bad1 is declared to have type `Template2` but is used as type `Concrete2_Bad1`. +protocols_definition.py:116:0 Incompatible variable type [9]: v2_bad2 is declared to have type `Template2` but is used as type `Concrete2_Bad2`. +protocols_definition.py:156:0 Incompatible variable type [9]: v3_bad1 is declared to have type `Template3` but is used as type `Concrete3_Bad1`. +protocols_definition.py:159:0 Incompatible variable type [9]: v3_bad4 is declared to have type `Template3` but is used as type `Concrete3_Bad4`. +protocols_definition.py:218:0 Incompatible variable type [9]: v4_bad1 is declared to have type `Template4` but is used as type `Concrete4_Bad1`. +protocols_definition.py:219:0 Incompatible variable type [9]: v4_bad2 is declared to have type `Template4` but is used as type `Concrete4_Bad2`. +protocols_definition.py:285:0 Incompatible variable type [9]: v5_bad1 is declared to have type `Template5` but is used as type `Concrete5_Bad1`. +protocols_definition.py:286:0 Incompatible variable type [9]: v5_bad2 is declared to have type `Template5` but is used as type `Concrete5_Bad2`. +protocols_definition.py:287:0 Incompatible variable type [9]: v5_bad3 is declared to have type `Template5` but is used as type `Concrete5_Bad3`. +protocols_definition.py:288:0 Incompatible variable type [9]: v5_bad4 is declared to have type `Template5` but is used as type `Concrete5_Bad4`. +protocols_definition.py:289:0 Incompatible variable type [9]: v5_bad5 is declared to have type `Template5` but is used as type `Concrete5_Bad5`. +""" diff --git a/conformance/results/pyre/protocols_explicit.toml b/conformance/results/pyre/protocols_explicit.toml new file mode 100644 index 000000000..ac27bcaad --- /dev/null +++ b/conformance/results/pyre/protocols_explicit.toml @@ -0,0 +1,15 @@ +conformant = "Partial" +notes = """ +Does not report error when calling unimplemented protocol method from derived class. +Does not report error when method is not implemented in derived class. +""" +output = """ +protocols_explicit.py:54:0 Uninitialized attribute [13]: Attribute `other` inherited from protocol `RGB` in class `Point` to have type `int` but is never initialized. +protocols_explicit.py:63:4 Invalid class instantiation [45]: Cannot instantiate abstract class `Point` with abstract method `intensity`. +protocols_explicit.py:86:0 Uninitialized attribute [13]: Attribute `cm1` inherited from protocol `Proto1` in class `Concrete1` to have type `int` but is never initialized. +protocols_explicit.py:86:0 Uninitialized attribute [13]: Attribute `im1` inherited from protocol `Proto1` in class `Concrete1` to have type `int` but is never initialized. +protocols_explicit.py:103:0 Uninitialized attribute [13]: Attribute `cm10` inherited from protocol `Proto2` in class `Concrete3` to have type `int` but is never initialized. +protocols_explicit.py:103:0 Uninitialized attribute [13]: Attribute `cm11` inherited from protocol `Proto3` in class `Concrete3` to have type `int` but is never initialized. +protocols_explicit.py:103:0 Uninitialized attribute [13]: Attribute `im1` inherited from protocol `Proto1` in class `Concrete3` to have type `int` but is never initialized. +protocols_explicit.py:171:6 Invalid class instantiation [45]: Cannot instantiate abstract class `Concrete7A` with abstract method `method1`. +""" diff --git a/conformance/results/pyre/protocols_generic.toml b/conformance/results/pyre/protocols_generic.toml new file mode 100644 index 000000000..45e702d11 --- /dev/null +++ b/conformance/results/pyre/protocols_generic.toml @@ -0,0 +1,13 @@ +conformant = "Partial" +notes = """ +Does not reject the use of Protocol and Generic together as base classes. +Does not detect protocol mismatch when method-scoped TypeVar is used in protocol. +""" +output = """ +protocols_generic.py:40:0 Incompatible variable type [9]: p2 is declared to have type `Proto1[int, str]` but is used as type `Concrete1`. +protocols_generic.py:56:4 Incompatible variable type [9]: v2 is declared to have type `Box[int]` but is used as type `Box[float]`. +protocols_generic.py:66:4 Incompatible variable type [9]: v2 is declared to have type `Sender[float]` but is used as type `Sender[int]`. +protocols_generic.py:74:4 Incompatible variable type [9]: v1 is declared to have type `AttrProto[float]` but is used as type `AttrProto[int]`. +protocols_generic.py:75:4 Incompatible variable type [9]: v2 is declared to have type `AttrProto[int]` but is used as type `AttrProto[float]`. +protocols_generic.py:146:0 Incompatible variable type [9]: hp3 is declared to have type `HasPropertyProto` but is used as type `ConcreteHasProperty3`. +""" diff --git a/conformance/results/pyre/protocols_merging.toml b/conformance/results/pyre/protocols_merging.toml new file mode 100644 index 000000000..ee1a86c18 --- /dev/null +++ b/conformance/results/pyre/protocols_merging.toml @@ -0,0 +1,11 @@ +conformant = "Partial" +notes = """ +Does not reject a protocol class that derives from a non-protocol class. +""" +output = """ +protocols_merging.py:52:0 Incompatible variable type [9]: s6 is declared to have type `SizedAndClosable1` but is used as type `SCConcrete2`. +protocols_merging.py:53:0 Incompatible variable type [9]: s7 is declared to have type `SizedAndClosable2` but is used as type `SCConcrete2`. +protocols_merging.py:54:0 Incompatible variable type [9]: s8 is declared to have type `SizedAndClosable3` but is used as type `SCConcrete2`. +protocols_merging.py:83:4 Invalid class instantiation [45]: Cannot instantiate abstract class `SizedAndClosable4` with abstract method `close`. +protocols_merging.py:84:0 Incompatible variable type [9]: y is declared to have type `SizedAndClosable4` but is used as type `SCConcrete1`. +""" diff --git a/conformance/results/pyre/protocols_modules.toml b/conformance/results/pyre/protocols_modules.toml new file mode 100644 index 000000000..8e5b07869 --- /dev/null +++ b/conformance/results/pyre/protocols_modules.toml @@ -0,0 +1,6 @@ +conformant = "Unsupported" +notes = """ +Does not perform protocol checks for modules. +""" +output = """ +""" diff --git a/conformance/results/pyre/protocols_recursive.toml b/conformance/results/pyre/protocols_recursive.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/pyre/protocols_recursive.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/pyre/protocols_runtime_checkable.toml b/conformance/results/pyre/protocols_runtime_checkable.toml new file mode 100644 index 000000000..80197221f --- /dev/null +++ b/conformance/results/pyre/protocols_runtime_checkable.toml @@ -0,0 +1,8 @@ +conformant = "Unsupported" +notes = """ +Does not reject isinstance or issubclass call for protocol that is not runtime_checkable. +Does not reject issubclass call for data protocol. +Does not report unsafe overlap for runtime_checkable protocol. +""" +output = """ +""" diff --git a/conformance/results/pyre/protocols_self.toml b/conformance/results/pyre/protocols_self.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/pyre/protocols_self.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/pyre/protocols_subtyping.toml b/conformance/results/pyre/protocols_subtyping.toml new file mode 100644 index 000000000..3fe6fc12c --- /dev/null +++ b/conformance/results/pyre/protocols_subtyping.toml @@ -0,0 +1,10 @@ +conformant = "Pass" +output = """ +protocols_subtyping.py:16:5 Invalid class instantiation [45]: Cannot instantiate protocol `Proto1`. +protocols_subtyping.py:38:4 Incompatible variable type [9]: v2 is declared to have type `Concrete2` but is used as type `Proto2`. +protocols_subtyping.py:55:4 Incompatible variable type [9]: v2 is declared to have type `Proto3` but is used as type `Proto2`. +protocols_subtyping.py:79:4 Incompatible variable type [9]: v3 is declared to have type `Proto4[int, float]` but is used as type `Proto5[int]`. +protocols_subtyping.py:80:4 Incompatible variable type [9]: v4 is declared to have type `Proto5[float]` but is used as type `Proto4[int, int]`. +protocols_subtyping.py:102:4 Incompatible variable type [9]: v4 is declared to have type `Proto7[int, float]` but is used as type `Proto6[float, float]`. +protocols_subtyping.py:103:4 Incompatible variable type [9]: v5 is declared to have type `Proto7[float, object]` but is used as type `Proto6[float, float]`. +""" diff --git a/conformance/results/pyre/protocols_variance.toml b/conformance/results/pyre/protocols_variance.toml new file mode 100644 index 000000000..26d50b961 --- /dev/null +++ b/conformance/results/pyre/protocols_variance.toml @@ -0,0 +1,8 @@ +conformant = "Unsupported" +notes = """ +Does not detect incorrect TypeVar variance within generic protocols. +""" +output = """ +protocols_variance.py:62:17 Invalid type variance [46]: The type variable `Variable[T1_co](covariant)` is covariant and cannot be a parameter type. +protocols_variance.py:72:4 Invalid type variance [46]: The type variable `Variable[T1_contra](contravariant)` is contravariant and cannot be a return type. +""" diff --git a/conformance/results/pyre/qualifiers_annotated.toml b/conformance/results/pyre/qualifiers_annotated.toml new file mode 100644 index 000000000..e0d4e1149 --- /dev/null +++ b/conformance/results/pyre/qualifiers_annotated.toml @@ -0,0 +1,18 @@ +conformant = "Partial" +notes = """ +Does not reject Annotated with a single parameter. +""" +output = """ +qualifiers_annotated.py:41:6 Undefined or invalid type [11]: Annotation `` is not defined as a type. +qualifiers_annotated.py:42:6 Invalid type [31]: Expression `typing.Annotated[(((int, str)), "")]` is not a valid type. +qualifiers_annotated.py:43:6 Invalid type [31]: Expression `typing.Annotated[(comprehension(int for generators(generator($target$i in range(1) if ))), "")]` is not a valid type. +qualifiers_annotated.py:44:6 Invalid type [31]: Expression `typing.Annotated[({ "a":"b" }, "")]` is not a valid type. +qualifiers_annotated.py:45:6 Invalid type [31]: Expression `typing.Annotated[(lambda () (int)(), "")]` is not a valid type. +qualifiers_annotated.py:46:6 Invalid type [31]: Expression `typing.Annotated[([int][0], "")]` is not a valid type. +qualifiers_annotated.py:47:6 Invalid type [31]: Expression `typing.Annotated[(int if 1 < 3 else str, "")]` is not a valid type. +qualifiers_annotated.py:48:16 Unbound name [10]: Name `var1` is used but not defined in the current scope. +qualifiers_annotated.py:49:6 Invalid type [31]: Expression `typing.Annotated[(True, "")]` is not a valid type. +qualifiers_annotated.py:50:7 Invalid type [31]: Expression `typing.Annotated[(1, "")]` is not a valid type. +qualifiers_annotated.py:51:7 Invalid type [31]: Expression `typing.Annotated[(list or set, "")]` is not a valid type. +qualifiers_annotated.py:52:7 Invalid type [31]: Expression `typing.Annotated[(f"{"int"}", "")]` is not a valid type. +""" diff --git a/conformance/results/pyre/qualifiers_final_annotation.toml b/conformance/results/pyre/qualifiers_final_annotation.toml new file mode 100644 index 000000000..79bd08fdb --- /dev/null +++ b/conformance/results/pyre/qualifiers_final_annotation.toml @@ -0,0 +1,34 @@ +conformant = "Partial" +notes = """ +Does not report Final variable with missing initialization in module scope. +Does not report error for invalid nesting of Final and ClassVar. +Does not treat use of Final name as if it was replaced by the literal in NamedTuple definition. +""" +output = """ +qualifiers_final_annotation.py:18:6 Invalid type parameters [24]: Generic type `Final` expects 1 type parameter, received 2. +qualifiers_final_annotation.py:28:0 Uninitialized attribute [13]: Attribute `ID3` is declared in class `ClassA` to have type `int` but is never initialized. +qualifiers_final_annotation.py:34:4 Invalid assignment [41]: Cannot reassign final attribute `ClassA.ID2`. +qualifiers_final_annotation.py:54:8 Invalid assignment [41]: Cannot reassign final attribute `self.ID5`. +qualifiers_final_annotation.py:62:8 Undefined attribute [16]: `ClassA` has no attribute `id3`. +qualifiers_final_annotation.py:63:8 Undefined attribute [16]: `ClassA` has no attribute `id4`. +qualifiers_final_annotation.py:65:8 Invalid assignment [41]: Cannot reassign final attribute `self.ID7`. +qualifiers_final_annotation.py:67:8 Invalid assignment [41]: Cannot reassign final attribute `self.ID7`. +qualifiers_final_annotation.py:71:0 Invalid assignment [41]: Cannot reassign final attribute `RATE`. +qualifiers_final_annotation.py:81:0 Invalid assignment [41]: Cannot reassign final attribute `ClassB.DEFAULT_ID`. +qualifiers_final_annotation.py:94:4 Invalid assignment [41]: Cannot reassign final attribute `BORDER_WIDTH`. +qualifiers_final_annotation.py:107:4 Incompatible attribute type [8]: Attribute `VALUE2` declared in class `ClassD` has type `Final` but is used as type `int`. +qualifiers_final_annotation.py:107:4 Invalid type [31]: Expression `Final` is not a valid type. Final cannot be nested. +qualifiers_final_annotation.py:118:0 Invalid type [31]: Expression `typing.List[Final[int]]` is not a valid type. Final cannot be nested. +qualifiers_final_annotation.py:121:10 Invalid type [31]: Parameter `x` cannot be annotated with Final. +qualifiers_final_annotation.py:131:0 Uninitialized attribute [13]: Attribute `($local_qualifiers_final_annotation$X, int)` is declared in class `N` to have type `typing.Any` but is never initialized. +qualifiers_final_annotation.py:131:0 Uninitialized attribute [13]: Attribute `($local_qualifiers_final_annotation$Y, int)` is declared in class `N` to have type `typing.Any` but is never initialized. +qualifiers_final_annotation.py:133:0 Unexpected keyword [28]: Unexpected keyword argument `x` to call `N.__init__`. +qualifiers_final_annotation.py:134:0 Unexpected keyword [28]: Unexpected keyword argument `a` to call `N.__init__`. +qualifiers_final_annotation.py:135:0 Unexpected keyword [28]: Unexpected keyword argument `x` to call `N.__init__`. +qualifiers_final_annotation.py:141:4 Invalid assignment [41]: Cannot reassign final attribute `ID1`. +qualifiers_final_annotation.py:145:4 Invalid assignment [41]: Cannot reassign final attribute `x`. +qualifiers_final_annotation.py:147:9 Invalid assignment [41]: Cannot reassign final attribute `x`. +qualifiers_final_annotation.py:149:8 Invalid assignment [41]: Cannot reassign final attribute `x`. +qualifiers_final_annotation.py:152:29 Invalid assignment [41]: Cannot reassign final attribute `x`. +qualifiers_final_annotation.py:155:8 Invalid assignment [41]: Cannot reassign final attribute `x`. +""" diff --git a/conformance/results/pyre/qualifiers_final_decorator.toml b/conformance/results/pyre/qualifiers_final_decorator.toml new file mode 100644 index 000000000..a9722413d --- /dev/null +++ b/conformance/results/pyre/qualifiers_final_decorator.toml @@ -0,0 +1,18 @@ +conformant = "Partial" +notes = """ +Reports error for overloaded method implementation marked @final if its overloads do not. +Does not report error for overloaded @final method defined in stub file. +Reports misleading error when overload is marked @final but implementation is not. +""" +output = """ +qualifiers_final_decorator.py:21:0 Invalid inheritance [39]: Cannot inherit from final class `Base1`. +qualifiers_final_decorator.py:51:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +qualifiers_final_decorator.py:56:4 Invalid override [40]: `qualifiers_final_decorator.Derived2.method1` cannot override final method defined in `Base2`. +qualifiers_final_decorator.py:60:4 Invalid override [40]: `qualifiers_final_decorator.Derived2.method2` cannot override final method defined in `Base2`. +qualifiers_final_decorator.py:64:4 Invalid override [40]: `qualifiers_final_decorator.Derived2.method3` cannot override final method defined in `Base2`. +qualifiers_final_decorator.py:75:4 Invalid override [40]: `qualifiers_final_decorator.Derived2.method4` cannot override final method defined in `Base2`. +qualifiers_final_decorator.py:86:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). +qualifiers_final_decorator.py:118:4 Inconsistent override [14]: `qualifiers_final_decorator.Derived5.method` overrides method defined in `Base5_2` inconsistently. Could not find parameter `v` in overriding signature. +qualifiers_final_decorator.py:118:4 Invalid override [40]: `qualifiers_final_decorator.Derived5.method` cannot override final method defined in `Base5_2`. +qualifiers_final_decorator.py:126:0 Invalid inheritance [39]: `final` cannot be used with non-method functions. +""" diff --git a/conformance/results/pyre/specialtypes_any.toml b/conformance/results/pyre/specialtypes_any.toml new file mode 100644 index 000000000..1af969071 --- /dev/null +++ b/conformance/results/pyre/specialtypes_any.toml @@ -0,0 +1,14 @@ +conformant = "Partial" +notes = """ +Does not treat missing type argument as Any in generic type. +Does not support Any as a base class. +""" +output = """ +specialtypes_any.py:48:27 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T]]` but got `object`. +specialtypes_any.py:49:27 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Tuple[Type[Variable[_KT]], Type[Variable[_VT]]]` but got `Tuple[object, object]`. +specialtypes_any.py:62:28 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T_co](covariant)]` but got `Tuple[object, typing.Any]`. +specialtypes_any.py:72:31 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Tuple[typing.Any, Type[Variable[$synthetic_attribute_resolution_variable]]]` but got `Tuple[typing.Any, object]`. +specialtypes_any.py:81:13 Invalid inheritance [39]: `typing.Any` is not a valid parent class. +specialtypes_any.py:87:12 Undefined attribute [16]: `ClassA` has no attribute `method2`. +specialtypes_any.py:88:12 Undefined attribute [16]: `ClassA` has no attribute `method3`. +""" diff --git a/conformance/results/pyre/specialtypes_never.toml b/conformance/results/pyre/specialtypes_never.toml new file mode 100644 index 000000000..fe5fe7b24 --- /dev/null +++ b/conformance/results/pyre/specialtypes_never.toml @@ -0,0 +1,17 @@ +conformant = "Partial" +notes = """ +Does not reject NoReturn when used outside of return type annotation. +Does not treat Never as compatible with all other types. +""" +output = """ +specialtypes_never.py:21:8 Incompatible return type [7]: Function declared non-returnable, but got `None`. +specialtypes_never.py:58:0 Uninitialized attribute [13]: Attribute `x` is declared in class `ClassA` to have type `NoReturn` but is never initialized. +specialtypes_never.py:58:0 Uninitialized attribute [13]: Attribute `y` is declared in class `ClassA` to have type `typing.List[NoReturn]` but is never initialized. +specialtypes_never.py:67:4 Incompatible variable type [9]: v1 is declared to have type `int` but is used as type `Never`. +specialtypes_never.py:68:4 Incompatible variable type [9]: v2 is declared to have type `str` but is used as type `Never`. +specialtypes_never.py:69:4 Incompatible variable type [9]: v3 is declared to have type `List[str]` but is used as type `Never`. +specialtypes_never.py:85:4 Incompatible variable type [9]: v3 is declared to have type `List[int]` but is used as type `List[Never]`. +specialtypes_never.py:86:4 Incompatible variable type [9]: v4 is declared to have type `Never` but is used as type `NoReturn`. +specialtypes_never.py:95:4 Incompatible return type [7]: Expected `ClassB[Variable[U]]` but got `ClassB[Never]`. +specialtypes_never.py:104:4 Incompatible return type [7]: Expected `ClassC[Variable[U]]` but got `ClassC[Never]`. +""" diff --git a/conformance/results/pyre/specialtypes_none.toml b/conformance/results/pyre/specialtypes_none.toml new file mode 100644 index 000000000..d96e591c0 --- /dev/null +++ b/conformance/results/pyre/specialtypes_none.toml @@ -0,0 +1,10 @@ +conformant = "Partial" +notes = """ +Does not correctly handle type annotation type[None]. +""" +output = """ +specialtypes_none.py:21:6 Incompatible parameter type [6]: In call `func1`, for 1st positional argument, expected `None` but got `Type[None]`. +specialtypes_none.py:27:0 Incompatible variable type [9]: none2 is declared to have type `Iterable[typing.Any]` but is used as type `None`. +specialtypes_none.py:36:27 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T_meta](covariant)]` but got `None`. +specialtypes_none.py:41:6 Incompatible parameter type [6]: In call `func2`, for 1st positional argument, expected `Type[None]` but got `None`. +""" diff --git a/conformance/results/pyre/specialtypes_promotions.toml b/conformance/results/pyre/specialtypes_promotions.toml new file mode 100644 index 000000000..18ce19078 --- /dev/null +++ b/conformance/results/pyre/specialtypes_promotions.toml @@ -0,0 +1,6 @@ +conformant = "Partial" +notes = """ +Does not reject use of attribute that is compatible only with float. +""" +output = """ +""" diff --git a/conformance/results/pyre/specialtypes_tuple.toml b/conformance/results/pyre/specialtypes_tuple.toml new file mode 100644 index 000000000..646b9965f --- /dev/null +++ b/conformance/results/pyre/specialtypes_tuple.toml @@ -0,0 +1,11 @@ +conformant = "Partial" +notes = """ +Does not report type violation when assigning tuple[T, ...] to tuple[T]. +""" +output = """ +specialtypes_tuple.py:12:0 Incompatible variable type [9]: t1 is declared to have type `Tuple[int]` but is used as type `Tuple[int, int]`. +specialtypes_tuple.py:14:0 Incompatible variable type [9]: t2 is declared to have type `Tuple[int, int]` but is used as type `Tuple[int]`. +specialtypes_tuple.py:15:0 Incompatible variable type [9]: t2 is declared to have type `Tuple[int, int]` but is used as type `Tuple[int, str]`. +specialtypes_tuple.py:25:0 Incompatible variable type [9]: t10 is declared to have type `Tuple[]` but is used as type `Tuple[int]`. +specialtypes_tuple.py:36:0 Incompatible variable type [9]: t20 is declared to have type `typing.Tuple[int, ...]` but is used as type `Tuple[int, int, int, str]`. +""" diff --git a/conformance/results/pyre/specialtypes_tuple_unpack.toml b/conformance/results/pyre/specialtypes_tuple_unpack.toml new file mode 100644 index 000000000..77ce9bff2 --- /dev/null +++ b/conformance/results/pyre/specialtypes_tuple_unpack.toml @@ -0,0 +1,43 @@ +conformant = "Unsupported" +notes = """ +Does not support unpacked tuple in type expression. +""" +output = """ +specialtypes_tuple_unpack.py:6:4 Invalid type [31]: Expression `tuple[(int, *tuple[str])]` is not a valid type. +specialtypes_tuple_unpack.py:7:0 Incompatible variable type [9]: t1 is declared to have type `Tuple[typing_extensions.Literal[1], typing_extensions.Literal['']]` but is used as type `Tuple[typing_extensions.Literal[1], typing_extensions.Literal[''], typing_extensions.Literal['']]`. +specialtypes_tuple_unpack.py:9:0 Incompatible variable type [9]: t2 is declared to have type `Tuple[int, unknown]` but is used as type `Tuple[int]`. +specialtypes_tuple_unpack.py:9:4 Invalid type [31]: Expression `tuple[(int, *tuple[(str, ...)])]` is not a valid type. +specialtypes_tuple_unpack.py:10:0 Incompatible variable type [9]: t2 is declared to have type `Tuple[typing_extensions.Literal[1]]` but is used as type `Tuple[typing_extensions.Literal[1], typing_extensions.Literal['']]`. +specialtypes_tuple_unpack.py:11:0 Incompatible variable type [9]: t2 is declared to have type `Tuple[typing_extensions.Literal[1]]` but is used as type `Tuple[typing_extensions.Literal[1], typing_extensions.Literal[''], typing_extensions.Literal['']]`. +specialtypes_tuple_unpack.py:12:0 Incompatible variable type [9]: t2 is declared to have type `Tuple[typing_extensions.Literal[1]]` but is used as type `Tuple[typing_extensions.Literal[1], typing_extensions.Literal[1], typing_extensions.Literal['']]`. +specialtypes_tuple_unpack.py:13:0 Incompatible variable type [9]: t2 is declared to have type `Tuple[typing_extensions.Literal[1]]` but is used as type `Tuple[typing_extensions.Literal[1], typing_extensions.Literal[''], typing_extensions.Literal[1]]`. +specialtypes_tuple_unpack.py:16:0 Incompatible variable type [9]: t3 is declared to have type `Tuple[int, unknown, int]` but is used as type `Tuple[int, int]`. +specialtypes_tuple_unpack.py:16:4 Invalid type [31]: Expression `tuple[(int, *tuple[(str, ...)], int)]` is not a valid type. +specialtypes_tuple_unpack.py:17:0 Incompatible variable type [9]: t3 is declared to have type `Tuple[typing_extensions.Literal[1], typing_extensions.Literal[2]]` but is used as type `Tuple[typing_extensions.Literal[1], typing_extensions.Literal[''], typing_extensions.Literal[2]]`. +specialtypes_tuple_unpack.py:18:0 Incompatible variable type [9]: t3 is declared to have type `Tuple[typing_extensions.Literal[1], typing_extensions.Literal[2]]` but is used as type `Tuple[typing_extensions.Literal[1], typing_extensions.Literal[''], typing_extensions.Literal[''], typing_extensions.Literal[2]]`. +specialtypes_tuple_unpack.py:19:0 Incompatible variable type [9]: t3 is declared to have type `Tuple[typing_extensions.Literal[1], typing_extensions.Literal[2]]` but is used as type `Tuple[typing_extensions.Literal[1], typing_extensions.Literal[''], typing_extensions.Literal['']]`. +specialtypes_tuple_unpack.py:20:0 Incompatible variable type [9]: t3 is declared to have type `Tuple[typing_extensions.Literal[1], typing_extensions.Literal[2]]` but is used as type `Tuple[typing_extensions.Literal[1], typing_extensions.Literal[''], typing_extensions.Literal[''], float]`. +specialtypes_tuple_unpack.py:22:0 Incompatible variable type [9]: t4 is declared to have type `Tuple[unknown, int]` but is used as type `Tuple[int]`. +specialtypes_tuple_unpack.py:22:4 Invalid type [31]: Expression `tuple[(*tuple[(str, ...)], int)]` is not a valid type. +specialtypes_tuple_unpack.py:23:0 Incompatible variable type [9]: t4 is declared to have type `Tuple[typing_extensions.Literal[1]]` but is used as type `Tuple[typing_extensions.Literal[''], typing_extensions.Literal[1]]`. +specialtypes_tuple_unpack.py:24:0 Incompatible variable type [9]: t4 is declared to have type `Tuple[typing_extensions.Literal[1]]` but is used as type `Tuple[typing_extensions.Literal[''], typing_extensions.Literal[''], typing_extensions.Literal[1]]`. +specialtypes_tuple_unpack.py:25:0 Incompatible variable type [9]: t4 is declared to have type `Tuple[typing_extensions.Literal[1]]` but is used as type `Tuple[typing_extensions.Literal[1], typing_extensions.Literal[''], typing_extensions.Literal[1]]`. +specialtypes_tuple_unpack.py:26:0 Incompatible variable type [9]: t4 is declared to have type `Tuple[typing_extensions.Literal[1]]` but is used as type `Tuple[typing_extensions.Literal[''], typing_extensions.Literal[''], float]`. +specialtypes_tuple_unpack.py:28:4 Invalid type [31]: Expression `tuple[(*tuple[str], *tuple[int])]` is not a valid type. +specialtypes_tuple_unpack.py:29:4 Invalid type [31]: Expression `tuple[(*tuple[(str, ...)], *tuple[(int, ...)])]` is not a valid type. +specialtypes_tuple_unpack.py:33:4 Incompatible variable type [9]: t1 is declared to have type `Tuple[str, str, unknown]` but is used as type `Tuple[str, str]`. +specialtypes_tuple_unpack.py:33:8 Invalid type [31]: Expression `tuple[(str, str, *tuple[(int, ...)])]` is not a valid type. +specialtypes_tuple_unpack.py:34:4 Incompatible variable type [9]: t2 is declared to have type `Tuple[str, str, unknown]` but is used as type `Tuple[str, str]`. +specialtypes_tuple_unpack.py:34:8 Invalid type [31]: Expression `tuple[(str, str, *tuple[int])]` is not a valid type. +specialtypes_tuple_unpack.py:35:8 Invalid type [31]: Expression `tuple[(str, *tuple[(str, ...)])]` is not a valid type. +specialtypes_tuple_unpack.py:36:4 Incompatible variable type [9]: t4 is declared to have type `Tuple[str, str, unknown]` but is used as type `Tuple[str, str]`. +specialtypes_tuple_unpack.py:36:8 Invalid type [31]: Expression `tuple[(str, str, *tuple[(str, ...)])]` is not a valid type. +specialtypes_tuple_unpack.py:37:4 Incompatible variable type [9]: t5 is declared to have type `Tuple[str, str, str, unknown]` but is used as type `Tuple[str, str]`. +specialtypes_tuple_unpack.py:37:8 Invalid type [31]: Expression `tuple[(str, str, str, *tuple[(str, ...)])]` is not a valid type. +specialtypes_tuple_unpack.py:38:4 Incompatible variable type [9]: t6 is declared to have type `Tuple[str, unknown, str]` but is used as type `Tuple[str, str]`. +specialtypes_tuple_unpack.py:38:8 Invalid type [31]: Expression `tuple[(str, *tuple[(int, ...)], str)]` is not a valid type. +specialtypes_tuple_unpack.py:39:8 Invalid type [31]: Expression `tuple[(*tuple[(str, ...)], str)]` is not a valid type. +specialtypes_tuple_unpack.py:40:8 Invalid type [31]: Expression `tuple[(*tuple[(str, ...)], str)]` is not a valid type. +specialtypes_tuple_unpack.py:41:4 Incompatible variable type [9]: t9 is declared to have type `Tuple[unknown, str, str, str]` but is used as type `Tuple[str, str]`. +specialtypes_tuple_unpack.py:41:8 Invalid type [31]: Expression `tuple[(*tuple[(str, ...)], str, str, str)]` is not a valid type. +""" diff --git a/conformance/results/pyre/specialtypes_type.toml b/conformance/results/pyre/specialtypes_type.toml new file mode 100644 index 000000000..c457538bc --- /dev/null +++ b/conformance/results/pyre/specialtypes_type.toml @@ -0,0 +1,25 @@ +conformant = "Partial" +notes = """ +Does not reject Callable when passed to type[T]. +Does not treat `type` same as `type[Any]` for assert_type. +Does not allow access to unknown attributes from object of type `type[Any]`. +Does not reject access to unknown attributes from object of type `Type[object]`. +Reports type incompatibility between `type` and `Callable[..., Any]`. +""" +output = """ +specialtypes_type.py:56:6 Incompatible parameter type [6]: In call `func4`, for 1st positional argument, expected `Type[Union[BasicUser, ProUser]]` but got `Type[TeamUser]`. +specialtypes_type.py:76:11 Invalid type parameters [24]: Generic type `type` expects 1 type parameter, received 2, use `typing.Type[]` to avoid runtime subscripting errors. +specialtypes_type.py:84:24 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T_meta](covariant)]` but got `object`. +specialtypes_type.py:98:33 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T_co](covariant)]` but got `Tuple[Type[type], typing.Any]`. +specialtypes_type.py:102:33 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T_co](covariant)]` but got `Tuple[Type[type], typing.Any]`. +specialtypes_type.py:106:33 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T_co](covariant)]` but got `Tuple[Type[type], typing.Any]`. +specialtypes_type.py:110:33 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T_co](covariant)]` but got `Tuple[Type[type], typing.Any]`. +specialtypes_type.py:117:4 Undefined attribute [16]: `object` has no attribute `unknown`. +specialtypes_type.py:137:24 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T_meta](covariant)]` but got `object`. +specialtypes_type.py:138:24 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T_meta](covariant)]` but got `object`. +specialtypes_type.py:139:24 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T_meta](covariant)]` but got `object`. +specialtypes_type.py:140:24 Incompatible parameter type [6]: In call `typing.GenericMeta.__getitem__`, for 1st positional argument, expected `Type[Variable[_T_meta](covariant)]` but got `object`. +specialtypes_type.py:143:0 Undefined attribute [16]: `TypeAlias` has no attribute `unknown`. +specialtypes_type.py:165:4 Incompatible variable type [9]: x1 is declared to have type `typing.Callable[..., typing.Any]` but is used as type `Type[typing.Any]`. +specialtypes_type.py:166:4 Incompatible variable type [9]: x2 is declared to have type `typing.Callable[[int, int], int]` but is used as type `Type[typing.Any]`. +""" diff --git a/conformance/results/pyre/version.toml b/conformance/results/pyre/version.toml index 91daa0eeb..1045fff1a 100644 --- a/conformance/results/pyre/version.toml +++ b/conformance/results/pyre/version.toml @@ -1,2 +1,2 @@ version = "pyre 0.9.19" -test_duration = 1.5496571063995361 +test_duration = 2.1209452152252197 diff --git a/conformance/results/pyright/aliases_explicit.toml b/conformance/results/pyright/aliases_explicit.toml index a69c20491..a90f7e995 100644 --- a/conformance/results/pyright/aliases_explicit.toml +++ b/conformance/results/pyright/aliases_explicit.toml @@ -1,10 +1,5 @@ -conformant = "Partial" -notes = """ -Incorrectly evaluates type of specialized type alias parameterized with ParamSpec. -Allows some illegal annotation forms to be interpreted as valid type aliases. -""" +conformant = "Pass" output = """ -aliases_explicit.py:57:17 - error: "assert_type" mismatch: expected "(int, str, str) -> None" but received "(int, str, str) -> None" (reportGeneralTypeIssues) aliases_explicit.py:67:24 - error: Expected no type arguments for class "int" (reportGeneralTypeIssues) aliases_explicit.py:67:24 - error: Expected no type arguments for class "NoneType" (reportGeneralTypeIssues) aliases_explicit.py:68:9 - error: Type "list[int | None]" is already specialized (reportGeneralTypeIssues) @@ -20,7 +15,6 @@ aliases_explicit.py:80:21 - error: Expected type expression but received "list[U aliases_explicit.py:81:21 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) aliases_explicit.py:81:21 - error: Tuple expression not allowed in type annotation   Use Tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) -aliases_explicit.py:81:21 - error: Expected type expression but received "tuple[tuple[type[int], type[str]]]" (reportGeneralTypeIssues) aliases_explicit.py:82:21 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) aliases_explicit.py:82:21 - error: List expression not allowed in type annotation   Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) @@ -31,6 +25,7 @@ aliases_explicit.py:83:21 - error: Dictionary expression not allowed in type ann aliases_explicit.py:83:21 - error: Expected type expression but received "dict[str, str]" (reportGeneralTypeIssues) aliases_explicit.py:84:21 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) aliases_explicit.py:84:21 - error: Call expression not allowed in type expression (reportGeneralTypeIssues) +aliases_explicit.py:85:21 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) aliases_explicit.py:85:21 - error: List expression not allowed in type annotation   Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) aliases_explicit.py:85:21 - error: Expected type expression but received "list[type[int]]" (reportGeneralTypeIssues) @@ -40,6 +35,7 @@ aliases_explicit.py:87:21 - error: Variable not allowed in type expression (repo aliases_explicit.py:88:22 - error: Expected type expression but received "Literal[True]" (reportGeneralTypeIssues) aliases_explicit.py:89:22 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) aliases_explicit.py:89:22 - error: Expected type expression but received "Literal[1]" (reportGeneralTypeIssues) +aliases_explicit.py:90:22 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) aliases_explicit.py:90:22 - error: Binary operator not allowed in type annotation aliases_explicit.py:91:22 - error: Expected expression aliases_explicit.py:91:22 - error: Tuple expression not allowed in type annotation diff --git a/conformance/results/pyright/aliases_implicit.toml b/conformance/results/pyright/aliases_implicit.toml index be26d5c86..c7a06c929 100644 --- a/conformance/results/pyright/aliases_implicit.toml +++ b/conformance/results/pyright/aliases_implicit.toml @@ -1,10 +1,5 @@ -conformant = "Partial" -notes = """ -Incorrectly evaluates type of specialized type alias parameterized with ParamSpec. -Allows some illegal annotation forms to be interpreted as valid type aliases. -""" +conformant = "Pass" output = """ -aliases_implicit.py:68:17 - error: "assert_type" mismatch: expected "(int, str, str) -> None" but received "(int, str, str) -> None" (reportGeneralTypeIssues) aliases_implicit.py:76:24 - error: Expected no type arguments for class "int" (reportGeneralTypeIssues) aliases_implicit.py:76:24 - error: Expected no type arguments for class "NoneType" (reportGeneralTypeIssues) aliases_implicit.py:77:9 - error: Type "list[int | None]" is already specialized (reportGeneralTypeIssues) @@ -19,10 +14,13 @@ aliases_implicit.py:107:9 - error: Variable not allowed in type expression (repo aliases_implicit.py:108:9 - error: Variable not allowed in type expression (reportGeneralTypeIssues) aliases_implicit.py:109:9 - error: Variable not allowed in type expression (reportGeneralTypeIssues) aliases_implicit.py:110:9 - error: Variable not allowed in type expression (reportGeneralTypeIssues) +aliases_implicit.py:111:9 - error: Variable not allowed in type expression (reportGeneralTypeIssues) +aliases_implicit.py:112:9 - error: Variable not allowed in type expression (reportGeneralTypeIssues) aliases_implicit.py:113:9 - error: Variable not allowed in type expression (reportGeneralTypeIssues) aliases_implicit.py:114:9 - error: Variable not allowed in type expression (reportGeneralTypeIssues) aliases_implicit.py:115:10 - error: Variable not allowed in type expression (reportGeneralTypeIssues) aliases_implicit.py:116:10 - error: Variable not allowed in type expression (reportGeneralTypeIssues) +aliases_implicit.py:117:10 - error: Variable not allowed in type expression (reportGeneralTypeIssues) aliases_implicit.py:118:10 - error: Variable not allowed in type expression (reportGeneralTypeIssues) aliases_implicit.py:119:10 - error: Variable not allowed in type expression (reportGeneralTypeIssues) aliases_implicit.py:133:6 - error: Object of type "type[list[Unknown]] | type[set[Unknown]]" is not callable (reportGeneralTypeIssues) diff --git a/conformance/results/pyright/aliases_newtype.toml b/conformance/results/pyright/aliases_newtype.toml index 5024de109..ffffb1adf 100644 --- a/conformance/results/pyright/aliases_newtype.toml +++ b/conformance/results/pyright/aliases_newtype.toml @@ -1,21 +1,20 @@ -conformant = "Partial" -notes = """ -Does not reject use of NewType in `isinstance` call. -Does not report inconsistency between name of NewType and assigned identifier name. -Does not reject use of NewType with TypedDict class. -Does not reject use of NewType with another NewType. -Does not reject use of NewType with Any. -""" +conformant = "Pass" output = """ aliases_newtype.py:11:8 - error: Argument of type "Literal['user']" cannot be assigned to parameter "_x" of type "int" in function "__init__"   "Literal['user']" is incompatible with "int" (reportGeneralTypeIssues) aliases_newtype.py:12:14 - error: Expression of type "Literal[42]" cannot be assigned to declared type "UserId"   "Literal[42]" is incompatible with "UserId" (reportGeneralTypeIssues) +aliases_newtype.py:20:16 - error: Second argument to "isinstance" must be a class or tuple of classes +  Class created with NewType cannot be used with instance and class checks (reportGeneralTypeIssues) aliases_newtype.py:23:21 - error: Base class "UserId" is marked final and cannot be subclassed +aliases_newtype.py:32:1 - error: NewType must be assigned to a variable with the same name (reportGeneralTypeIssues) aliases_newtype.py:36:19 - error: Expected no type arguments for class "GoodNewType1" (reportGeneralTypeIssues) aliases_newtype.py:42:38 - error: Expected class as second argument to NewType aliases_newtype.py:45:43 - error: Type variable "T" has no meaning in this context (reportGeneralTypeIssues) -aliases_newtype.py:47:38 - error: NewType cannot be used with protocol class +aliases_newtype.py:47:38 - error: NewType cannot be used with structural type (a protocol or TypedDict class) aliases_newtype.py:49:38 - error: NewType cannot be used with Literal type +aliases_newtype.py:56:38 - error: NewType cannot be used with structural type (a protocol or TypedDict class) +aliases_newtype.py:58:38 - error: NewType cannot be used with a class created with NewType aliases_newtype.py:60:15 - error: NewType requires two positional arguments (reportGeneralTypeIssues) +aliases_newtype.py:62:38 - error: The second argument to NewType must be a known class, not Any or Unknown (reportGeneralTypeIssues) """ diff --git a/conformance/results/pyright/aliases_type_statement.toml b/conformance/results/pyright/aliases_type_statement.toml index abc0dc775..0c987a446 100644 --- a/conformance/results/pyright/aliases_type_statement.toml +++ b/conformance/results/pyright/aliases_type_statement.toml @@ -1,10 +1,5 @@ -conformant = "Partial" -notes = """ -Does not reject binary expression when used in type alias definition. -""" +conformant = "Pass" output = """ -aliases_type_statement.py:44:26 - error: Statements must be separated by newlines or semicolons -aliases_type_statement.py:44:35 - error: Expected ":" aliases_type_statement.py:17:12 - error: Cannot access member "bit_count" for type "TypeAliasType"   Member "bit_count" is unknown (reportGeneralTypeIssues) aliases_type_statement.py:19:1 - error: Object of type "TypeAliasType" is not callable (reportGeneralTypeIssues) @@ -16,22 +11,30 @@ aliases_type_statement.py:31:22 - error: Argument of type "TypeAliasType" cannot     "TypeAliasType" is incompatible with "type"     "TypeAliasType" is incompatible with "UnionType"     "TypeAliasType" is incompatible with "tuple[_ClassInfo, ...]" (reportGeneralTypeIssues) -aliases_type_statement.py:37:22 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) -aliases_type_statement.py:38:22 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) +aliases_type_statement.py:37:22 - error: Call expression not allowed in type expression (reportGeneralTypeIssues) +aliases_type_statement.py:38:22 - error: List expression not allowed in type annotation +  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) aliases_type_statement.py:38:22 - error: Expected type expression but received "list[Unknown]" (reportGeneralTypeIssues) -aliases_type_statement.py:39:22 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) -aliases_type_statement.py:39:22 - error: Expected type expression but received "tuple[tuple[type[int], type[str]]]" (reportGeneralTypeIssues) -aliases_type_statement.py:40:22 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) +aliases_type_statement.py:39:22 - error: Tuple expression not allowed in type annotation +  Use Tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) +aliases_type_statement.py:40:22 - error: List expression not allowed in type annotation +  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) aliases_type_statement.py:40:22 - error: Expected type expression but received "list[type[int]]" (reportGeneralTypeIssues) -aliases_type_statement.py:41:22 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) +aliases_type_statement.py:41:22 - error: Dictionary expression not allowed in type annotation +  Use Dict[T1, T2] to indicate a dictionary type (reportGeneralTypeIssues) aliases_type_statement.py:41:22 - error: Expected type expression but received "dict[str, str]" (reportGeneralTypeIssues) -aliases_type_statement.py:42:22 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) +aliases_type_statement.py:42:22 - error: Call expression not allowed in type expression (reportGeneralTypeIssues) +aliases_type_statement.py:43:22 - error: List expression not allowed in type annotation +  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) aliases_type_statement.py:43:22 - error: Expected type expression but received "list[type[int]]" (reportGeneralTypeIssues) -aliases_type_statement.py:45:22 - error: Expected type expression but received "int" (reportGeneralTypeIssues) +aliases_type_statement.py:44:22 - error: Ternary expression not allowed in type annotation +aliases_type_statement.py:45:22 - error: Variable not allowed in type expression (reportGeneralTypeIssues) aliases_type_statement.py:46:23 - error: Expected type expression but received "Literal[True]" (reportGeneralTypeIssues) -aliases_type_statement.py:47:23 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) aliases_type_statement.py:47:23 - error: Expected type expression but received "Literal[1]" (reportGeneralTypeIssues) +aliases_type_statement.py:48:23 - error: Binary operator not allowed in type annotation aliases_type_statement.py:49:23 - error: Expected expression +aliases_type_statement.py:49:23 - error: Tuple expression not allowed in type annotation +  Use Tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) aliases_type_statement.py:58:10 - error: A type statement can be used only within a module or class scope aliases_type_statement.py:64:23 - error: Type parameter "V" is not included in the type parameter list for "TA1" (reportGeneralTypeIssues) aliases_type_statement.py:69:17 - error: Type parameter "T1" is not included in the type parameter list for "TA2" (reportGeneralTypeIssues) diff --git a/conformance/results/pyright/aliases_typealiastype.toml b/conformance/results/pyright/aliases_typealiastype.toml index 34329cf9d..a71693625 100644 --- a/conformance/results/pyright/aliases_typealiastype.toml +++ b/conformance/results/pyright/aliases_typealiastype.toml @@ -1,37 +1,31 @@ -conformant = "Partial" -notes = """ -Does not reject type alias with TypeVar that is not in scope and not in `type_params`. -Does not allow access to `__value__` attribute of type alias. -Allows some illegal annotation forms to be interpreted as valid type aliases. -""" +conformant = "Pass" output = """ -aliases_typealiastype.py:30:18 - error: Cannot access member "__value__" for type "GoodAlias1" -  Member "__value__" is unknown (reportGeneralTypeIssues) -aliases_typealiastype.py:32:18 - error: Cannot access member "other_attrib" for type "GoodAlias1" +aliases_typealiastype.py:32:18 - error: Cannot access member "other_attrib" for type "TypeAliasType"   Member "other_attrib" is unknown (reportGeneralTypeIssues) aliases_typealiastype.py:40:5 - error: Could not specialize type "GoodAlias5[S@GoodAlias5, TStr@GoodAlias5, P@GoodAlias5, Ts@GoodAlias5]"   Type "int" cannot be assigned to type "str"     "int" is incompatible with "str" aliases_typealiastype.py:44:23 - error: Type variable "S" has no meaning in this context (reportGeneralTypeIssues) +aliases_typealiastype.py:46:45 - error: Type variable "S" has no meaning in this context (reportGeneralTypeIssues) aliases_typealiastype.py:48:35 - error: Type parameter list must be a tuple containing only TypeVar, TypeVarTuple, or ParamSpec aliases_typealiastype.py:50:40 - error: Type alias "BadAlias4" cannot use itself in its definition (reportGeneralTypeIssues) aliases_typealiastype.py:52:18 - error: Type alias "BadAlias5" cannot use itself in its definition (reportGeneralTypeIssues) aliases_typealiastype.py:54:40 - error: Type alias "BadAlias6" cannot use itself in its definition (reportGeneralTypeIssues) -aliases_typealiastype.py:58:40 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) -aliases_typealiastype.py:59:40 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) +aliases_typealiastype.py:58:40 - error: Call expression not allowed in type expression (reportGeneralTypeIssues) aliases_typealiastype.py:59:40 - error: Expected type expression but received "list[Unknown]" (reportGeneralTypeIssues) -aliases_typealiastype.py:60:42 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) aliases_typealiastype.py:60:42 - error: Expected type expression but received "tuple[tuple[type[int], type[str]]]" (reportGeneralTypeIssues) -aliases_typealiastype.py:61:42 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) aliases_typealiastype.py:61:42 - error: Expected type expression but received "list[type[int]]" (reportGeneralTypeIssues) -aliases_typealiastype.py:62:42 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) aliases_typealiastype.py:62:42 - error: Expected type expression but received "dict[str, str]" (reportGeneralTypeIssues) -aliases_typealiastype.py:63:42 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) +aliases_typealiastype.py:63:42 - error: Call expression not allowed in type expression (reportGeneralTypeIssues) +aliases_typealiastype.py:64:42 - error: List expression not allowed in type annotation +  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) aliases_typealiastype.py:64:42 - error: Expected type expression but received "list[type[int]]" (reportGeneralTypeIssues) -aliases_typealiastype.py:65:42 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) -aliases_typealiastype.py:66:42 - error: Expected type expression but received "int" (reportGeneralTypeIssues) +aliases_typealiastype.py:65:42 - error: Ternary expression not allowed in type annotation +aliases_typealiastype.py:66:42 - error: Variable not allowed in type expression (reportGeneralTypeIssues) aliases_typealiastype.py:67:42 - error: Expected type expression but received "Literal[True]" (reportGeneralTypeIssues) -aliases_typealiastype.py:68:42 - error: Invalid expression form for type alias definition (reportGeneralTypeIssues) aliases_typealiastype.py:68:42 - error: Expected type expression but received "Literal[1]" (reportGeneralTypeIssues) +aliases_typealiastype.py:69:42 - error: Binary operator not allowed in type annotation aliases_typealiastype.py:70:42 - error: Expected expression +aliases_typealiastype.py:70:42 - error: Tuple expression not allowed in type annotation +  Use Tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) """ diff --git a/conformance/results/pyright/annotations_coroutines.toml b/conformance/results/pyright/annotations_coroutines.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/pyright/annotations_coroutines.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/pyright/annotations_forward_refs.toml b/conformance/results/pyright/annotations_forward_refs.toml new file mode 100644 index 000000000..1ace3b6bc --- /dev/null +++ b/conformance/results/pyright/annotations_forward_refs.toml @@ -0,0 +1,37 @@ +conformant = "Pass" +output = """ +annotations_forward_refs.py:22:7 - error: "ClassA" is not defined (reportUndefinedVariable) +annotations_forward_refs.py:23:12 - error: "ClassA" is not defined (reportUndefinedVariable) +annotations_forward_refs.py:24:7 - error: Union syntax cannot be used with string operand; use quotes around entire expression (reportGeneralTypeIssues) +annotations_forward_refs.py:25:13 - error: Union syntax cannot be used with string operand; use quotes around entire expression (reportGeneralTypeIssues) +annotations_forward_refs.py:41:9 - error: Expected type but received a string literal (reportGeneralTypeIssues) +annotations_forward_refs.py:42:10 - error: List expression not allowed in type annotation +  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) +annotations_forward_refs.py:42:10 - error: Expected type expression but received "list[Unknown]" (reportGeneralTypeIssues) +annotations_forward_refs.py:43:10 - error: Tuple expression not allowed in type annotation +  Use Tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) +annotations_forward_refs.py:44:10 - error: List expression not allowed in type annotation +  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) +annotations_forward_refs.py:44:10 - error: Expected type expression but received "list[type[int]]" (reportGeneralTypeIssues) +annotations_forward_refs.py:45:10 - error: Dictionary expression not allowed in type annotation +  Use Dict[T1, T2] to indicate a dictionary type (reportGeneralTypeIssues) +annotations_forward_refs.py:45:10 - error: Expected type expression but received "dict[Unknown, Unknown]" (reportGeneralTypeIssues) +annotations_forward_refs.py:46:10 - error: Call expression not allowed in type expression (reportGeneralTypeIssues) +annotations_forward_refs.py:47:10 - error: List expression not allowed in type annotation +  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) +annotations_forward_refs.py:47:10 - error: Expected type expression but received "list[type[int]]" (reportGeneralTypeIssues) +annotations_forward_refs.py:48:10 - error: Ternary expression not allowed in type annotation +annotations_forward_refs.py:49:10 - error: Variable not allowed in type expression (reportGeneralTypeIssues) +annotations_forward_refs.py:50:11 - error: Expected type expression but received "Literal[True]" (reportGeneralTypeIssues) +annotations_forward_refs.py:51:11 - error: Expected type expression but received "Literal[1]" (reportGeneralTypeIssues) +annotations_forward_refs.py:52:11 - error: Unary operator not allowed in type annotation +annotations_forward_refs.py:53:11 - error: Binary operator not allowed in type annotation +annotations_forward_refs.py:54:11 - error: Expected expression +annotations_forward_refs.py:54:11 - error: Tuple expression not allowed in type annotation +  Use Tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) +annotations_forward_refs.py:55:10 - error: Module cannot be used as a type (reportGeneralTypeIssues) +annotations_forward_refs.py:66:26 - error: "ClassB" is not defined (reportUndefinedVariable) +annotations_forward_refs.py:80:14 - error: Type of "ClassF" could not be determined because it refers to itself (reportGeneralTypeIssues) +annotations_forward_refs.py:80:14 - error: Variable not allowed in type expression (reportGeneralTypeIssues) +annotations_forward_refs.py:89:8 - error: Expected type expression but received "(self: Self@ClassD) -> None" (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/annotations_generators.toml b/conformance/results/pyright/annotations_generators.toml new file mode 100644 index 000000000..9104ee128 --- /dev/null +++ b/conformance/results/pyright/annotations_generators.toml @@ -0,0 +1,33 @@ +conformant = "Pass" +output = """ +annotations_generators.py:54:16 - error: Expression of type "Literal[False]" cannot be assigned to return type "C" +  "Literal[False]" is incompatible with "C" (reportGeneralTypeIssues) +annotations_generators.py:57:15 - error: Return type of generator function must be compatible with "Generator[Literal[3], Any, Any]" +  "Literal[3]" is incompatible with "A" (reportGeneralTypeIssues) +annotations_generators.py:51:21 - error: Function with declared return type "C" must return value on all code paths +  "None" is incompatible with "C" (reportGeneralTypeIssues) +annotations_generators.py:66:15 - error: Return type of generator function must be compatible with "Generator[Literal[3], Any, Any]" +  "Literal[3]" is incompatible with "A" (reportGeneralTypeIssues) +annotations_generators.py:75:11 - error: Return type of generator function must be compatible with "Generator[B, Any, Any]" +  "B" is incompatible with "A" (reportGeneralTypeIssues) +annotations_generators.py:87:11 - error: Return type of generator function must be compatible with "Generator[None, Any, Any]" +  "Generator[None, Unknown, Unknown]" is incompatible with "int" (reportGeneralTypeIssues) +annotations_generators.py:86:21 - error: Return type of generator function must be compatible with "Generator[Any, Any, Any]" +  "Generator[Any, Any, Any]" is incompatible with "int" (reportGeneralTypeIssues) +annotations_generators.py:92:11 - error: Return type of async generator function must be compatible with "AsyncGenerator[None, Any]" +  "AsyncGenerator[None, Unknown, Unknown]" is incompatible with "int" (reportGeneralTypeIssues) +annotations_generators.py:91:27 - error: Return type of async generator function must be compatible with "AsyncGenerator[Any, Any]" +  "AsyncGenerator[Any, Any, Any]" is incompatible with "int" (reportGeneralTypeIssues) +annotations_generators.py:118:16 - error: Return type of generator function must be compatible with "Generator[A, Any, Any]" +  "Generator[A, Unknown, Unknown]" is incompatible with "Iterator[B]" +    Type parameter "_T_co@Iterator" is covariant, but "A" is not a subtype of "B" +      "A" is incompatible with "B" (reportGeneralTypeIssues) +annotations_generators.py:119:16 - error: Return type of generator function must be compatible with "Generator[int, Any, Any]" +  "Generator[int, Unknown, Unknown]" is incompatible with "Iterator[B]" +    Type parameter "_T_co@Iterator" is covariant, but "int" is not a subtype of "B" +      "int" is incompatible with "B" (reportGeneralTypeIssues) +annotations_generators.py:135:16 - error: Return type of generator function must be compatible with "Generator[None, Any, Any]" +  "Generator[None, int, Unknown]" is incompatible with "Generator[None, str, None]" +    Type parameter "_SendT_contra@Generator" is contravariant, but "int" is not a supertype of "str" +      "str" is incompatible with "int" (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/annotations_methods.toml b/conformance/results/pyright/annotations_methods.toml new file mode 100644 index 000000000..3a22f5f82 --- /dev/null +++ b/conformance/results/pyright/annotations_methods.toml @@ -0,0 +1,8 @@ +conformant = "Pass" +notes = """ +Type evaluation differs from other type checkers because of ambiguity in the spec related to method bindings. +""" +output = """ +annotations_methods.py:46:8 - error: Argument of type "A" cannot be assigned to parameter "self" of type "B" in function "copy" +  "A" is incompatible with "B" (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/annotations_typeexpr.toml b/conformance/results/pyright/annotations_typeexpr.toml index f1bd93080..bf313b95f 100644 --- a/conformance/results/pyright/annotations_typeexpr.toml +++ b/conformance/results/pyright/annotations_typeexpr.toml @@ -1,29 +1,29 @@ conformant = "Pass" output = """ -annotations_typeexpr.py:77:9 - error: Call expression not allowed in type expression (reportGeneralTypeIssues) -annotations_typeexpr.py:78:9 - error: List expression not allowed in type annotation +annotations_typeexpr.py:88:9 - error: Call expression not allowed in type expression (reportGeneralTypeIssues) +annotations_typeexpr.py:89:9 - error: List expression not allowed in type annotation   Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) -annotations_typeexpr.py:78:9 - error: Expected type expression but received "list[Unknown]" (reportGeneralTypeIssues) -annotations_typeexpr.py:79:9 - error: Tuple expression not allowed in type annotation +annotations_typeexpr.py:89:9 - error: Expected type expression but received "list[Unknown]" (reportGeneralTypeIssues) +annotations_typeexpr.py:90:9 - error: Tuple expression not allowed in type annotation   Use Tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) -annotations_typeexpr.py:79:9 - error: Expected type expression but received "tuple[type[int], type[str]]" (reportGeneralTypeIssues) -annotations_typeexpr.py:80:9 - error: List expression not allowed in type annotation +annotations_typeexpr.py:91:9 - error: List expression not allowed in type annotation   Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) -annotations_typeexpr.py:80:9 - error: Expected type expression but received "list[type[int]]" (reportGeneralTypeIssues) -annotations_typeexpr.py:81:9 - error: Dictionary expression not allowed in type annotation +annotations_typeexpr.py:91:9 - error: Expected type expression but received "list[type[int]]" (reportGeneralTypeIssues) +annotations_typeexpr.py:92:9 - error: Dictionary expression not allowed in type annotation   Use Dict[T1, T2] to indicate a dictionary type (reportGeneralTypeIssues) -annotations_typeexpr.py:81:9 - error: Expected type expression but received "dict[Unknown, Unknown]" (reportGeneralTypeIssues) -annotations_typeexpr.py:82:9 - error: Call expression not allowed in type expression (reportGeneralTypeIssues) -annotations_typeexpr.py:83:9 - error: List expression not allowed in type annotation +annotations_typeexpr.py:92:9 - error: Expected type expression but received "dict[Unknown, Unknown]" (reportGeneralTypeIssues) +annotations_typeexpr.py:93:9 - error: Call expression not allowed in type expression (reportGeneralTypeIssues) +annotations_typeexpr.py:94:9 - error: List expression not allowed in type annotation   Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) -annotations_typeexpr.py:83:9 - error: Expected type expression but received "list[type[int]]" (reportGeneralTypeIssues) -annotations_typeexpr.py:84:9 - error: Ternary expression not allowed in type annotation -annotations_typeexpr.py:85:9 - error: Variable not allowed in type expression (reportGeneralTypeIssues) -annotations_typeexpr.py:86:10 - error: Expected type expression but received "Literal[True]" (reportGeneralTypeIssues) -annotations_typeexpr.py:87:10 - error: Expected type expression but received "Literal[1]" (reportGeneralTypeIssues) -annotations_typeexpr.py:88:10 - error: Unary operator not allowed in type annotation -annotations_typeexpr.py:89:10 - error: Binary operator not allowed in type annotation -annotations_typeexpr.py:90:10 - error: Expected expression -annotations_typeexpr.py:90:10 - error: Tuple expression not allowed in type annotation +annotations_typeexpr.py:94:9 - error: Expected type expression but received "list[type[int]]" (reportGeneralTypeIssues) +annotations_typeexpr.py:95:9 - error: Ternary expression not allowed in type annotation +annotations_typeexpr.py:96:9 - error: Variable not allowed in type expression (reportGeneralTypeIssues) +annotations_typeexpr.py:97:10 - error: Expected type expression but received "Literal[True]" (reportGeneralTypeIssues) +annotations_typeexpr.py:98:10 - error: Expected type expression but received "Literal[1]" (reportGeneralTypeIssues) +annotations_typeexpr.py:99:10 - error: Unary operator not allowed in type annotation +annotations_typeexpr.py:100:10 - error: Binary operator not allowed in type annotation +annotations_typeexpr.py:101:10 - error: Expected expression +annotations_typeexpr.py:101:10 - error: Tuple expression not allowed in type annotation   Use Tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) +annotations_typeexpr.py:102:10 - error: Module cannot be used as a type (reportGeneralTypeIssues) """ diff --git a/conformance/results/pyright/callables_protocol.toml b/conformance/results/pyright/callables_protocol.toml index 7e548a2a7..c4393daa5 100644 --- a/conformance/results/pyright/callables_protocol.toml +++ b/conformance/results/pyright/callables_protocol.toml @@ -1,7 +1,4 @@ -conformant = "Partial" -notes = """ -Does not report type incompatibility for callback protocol with positional-only parameters. -""" +conformant = "Pass" output = """ callables_protocol.py:35:7 - error: Expression of type "(*vals: bytes, max_items: int | None) -> list[bytes]" cannot be assigned to declared type "Proto1"   Type "(*vals: bytes, max_items: int | None) -> list[bytes]" cannot be assigned to type "(*vals: bytes, max_len: int | None = None) -> list[bytes]" @@ -47,6 +44,9 @@ callables_protocol.py:187:15 - error: Cannot assign member "xxx" for type "Proto   Member "xxx" is unknown (reportGeneralTypeIssues) callables_protocol.py:197:16 - error: Cannot access member "other_attribute2" for type "Proto9[(x: int), str]"   Member "other_attribute2" is unknown (reportGeneralTypeIssues) +callables_protocol.py:238:8 - error: Expression of type "(x: int, y: str, /) -> Any" cannot be assigned to declared type "Proto11" +  Type "(x: int, y: str, /) -> Any" cannot be assigned to type "(x: int, /, y: str) -> Any" +    Position-only parameter mismatch; parameter "y" is not position-only (reportGeneralTypeIssues) callables_protocol.py:260:8 - error: Expression of type "(*args: Any, kwarg0: Any) -> None" cannot be assigned to declared type "Proto12"   Type "(*args: Any, kwarg0: Any) -> None" cannot be assigned to type "(*args: Any, kwarg0: Any, kwarg1: Any) -> None"     Keyword parameter "kwarg1" is missing in source (reportGeneralTypeIssues) diff --git a/conformance/results/pyright/classes_classvar.toml b/conformance/results/pyright/classes_classvar.toml new file mode 100644 index 000000000..471d0a27d --- /dev/null +++ b/conformance/results/pyright/classes_classvar.toml @@ -0,0 +1,24 @@ +conformant = "Pass" +output = """ +classes_classvar.py:36:25 - error: Expected only one type argument after "ClassVar" +classes_classvar.py:37:14 - error: Expected type expression but received "Literal[3]" (reportGeneralTypeIssues) +classes_classvar.py:38:14 - error: "var" is not defined (reportUndefinedVariable) +classes_classvar.py:43:20 - error: "ClassVar" type cannot include type variables (reportGeneralTypeIssues) +classes_classvar.py:44:20 - error: "ClassVar" type cannot include type variables (reportGeneralTypeIssues) +classes_classvar.py:45:20 - error: "ClassVar" type cannot include type variables (reportGeneralTypeIssues) +classes_classvar.py:50:33 - error: Expression of type "dict[Any, Any]" cannot be assigned to declared type "list[str]" (reportGeneralTypeIssues) +classes_classvar.py:52:11 - error: "Final" is not defined (reportUndefinedVariable) +classes_classvar.py:53:17 - error: "ClassVar" is not allowed in this context +classes_classvar.py:61:26 - error: "ClassVar" is not allowed in this context +classes_classvar.py:62:12 - error: "ClassVar" is not allowed in this context +classes_classvar.py:63:18 - error: "ClassVar" is not allowed in this context +classes_classvar.py:65:26 - error: "ClassVar" is not allowed in this context +classes_classvar.py:69:8 - error: "ClassVar" is not allowed in this context +classes_classvar.py:70:20 - error: "ClassVar" is not allowed in this context +classes_classvar.py:100:14 - error: Cannot assign member "stats" for type "Starship" +  Member "stats" cannot be assigned through a class instance because it is a ClassVar +    Member "__set__" is unknown (reportGeneralTypeIssues) +classes_classvar.py:129:13 - error: Expression of type "ProtoAImpl" cannot be assigned to declared type "ProtoA" +  "ProtoAImpl" is incompatible with protocol "ProtoA" +    "y" is not a class variable (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/classes_override.toml b/conformance/results/pyright/classes_override.toml new file mode 100644 index 000000000..8fa4d0924 --- /dev/null +++ b/conformance/results/pyright/classes_override.toml @@ -0,0 +1,8 @@ +conformant = "Pass" +output = """ +classes_override.py:53:9 - error: Method "method3" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) +classes_override.py:65:9 - error: Method "method4" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) +classes_override.py:79:9 - error: Method "static_method1" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) +classes_override.py:84:9 - error: Method "class_method1" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) +classes_override.py:91:9 - error: Method "property1" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/dataclasses_postinit.toml b/conformance/results/pyright/dataclasses_postinit.toml index 3ac995fe2..8dd024294 100644 --- a/conformance/results/pyright/dataclasses_postinit.toml +++ b/conformance/results/pyright/dataclasses_postinit.toml @@ -1,7 +1,4 @@ -conformant = "Partial" -notes = """ -Reports incorrect error for incompatible `__post_init__` method override. -""" +conformant = "Pass" output = """ dataclasses_postinit.py:19:40 - error: Dataclass __post_init__ method parameter type mismatch for field "y"   "str" is incompatible with "int" (reportGeneralTypeIssues) @@ -10,6 +7,4 @@ dataclasses_postinit.py:28:11 - error: Cannot access member "x" for type "DC1" dataclasses_postinit.py:29:11 - error: Cannot access member "y" for type "DC1"   Member "y" is an init-only field (reportGeneralTypeIssues) dataclasses_postinit.py:36:9 - error: Dataclass __post_init__ incorrect parameter count; number of InitVar fields is 2 (reportGeneralTypeIssues) -dataclasses_postinit.py:54:9 - error: Method "__post_init__" overrides class "DC3" in an incompatible manner -  Positional parameter count mismatch; base method has 2, but override has 3 (reportIncompatibleMethodOverride) """ diff --git a/conformance/results/pyright/directives_assert_type.toml b/conformance/results/pyright/directives_assert_type.toml new file mode 100644 index 000000000..ea8b7aa4a --- /dev/null +++ b/conformance/results/pyright/directives_assert_type.toml @@ -0,0 +1,9 @@ +conformant = "Pass" +output = """ +directives_assert_type.py:27:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportGeneralTypeIssues) +directives_assert_type.py:28:17 - error: "assert_type" mismatch: expected "int" but received "Any" (reportGeneralTypeIssues) +directives_assert_type.py:29:17 - error: "assert_type" mismatch: expected "int" but received "Literal[4]" (reportGeneralTypeIssues) +directives_assert_type.py:31:5 - error: "assert_type" expects two positional arguments +directives_assert_type.py:32:17 - error: "assert_type" mismatch: expected "int" but received "Literal['']" (reportGeneralTypeIssues) +directives_assert_type.py:33:5 - error: "assert_type" expects two positional arguments +""" diff --git a/conformance/results/pyright/directives_cast.toml b/conformance/results/pyright/directives_cast.toml new file mode 100644 index 000000000..f23fa43ef --- /dev/null +++ b/conformance/results/pyright/directives_cast.toml @@ -0,0 +1,8 @@ +conformant = "Pass" +output = """ +directives_cast.py:15:8 - error: No overloads for "cast" match the provided arguments +  Argument types: () (reportGeneralTypeIssues) +directives_cast.py:16:13 - error: Expected type expression but received "Literal[1]" (reportGeneralTypeIssues) +directives_cast.py:17:8 - error: No overloads for "cast" match the provided arguments +  Argument types: (type[int], Literal[''], Literal['']) (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/directives_no_type_check.toml b/conformance/results/pyright/directives_no_type_check.toml new file mode 100644 index 000000000..6bc67f59b --- /dev/null +++ b/conformance/results/pyright/directives_no_type_check.toml @@ -0,0 +1,14 @@ +conformant = "Unsupported" +notes = """ +Intentionally does not honor @no_type_check decorator. +""" +output = """ +directives_no_type_check.py:16:9 - error: Operator "+" not supported for types "int" and "str" (reportGeneralTypeIssues) +directives_no_type_check.py:17:12 - error: Expression of type "Literal[1]" cannot be assigned to return type "None" +  "Literal[1]" is incompatible with "None" (reportGeneralTypeIssues) +directives_no_type_check.py:20:7 - error: Argument of type "Literal[b"invalid"]" cannot be assigned to parameter "a" of type "int" in function "func1" +  "Literal[b"invalid"]" is incompatible with "int" (reportGeneralTypeIssues) +directives_no_type_check.py:20:19 - error: Argument of type "Literal[b"arguments"]" cannot be assigned to parameter "b" of type "str" in function "func1" +  "Literal[b"arguments"]" is incompatible with "str" (reportGeneralTypeIssues) +directives_no_type_check.py:21:1 - error: Arguments missing for parameters "a", "b" (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/directives_reveal_type.toml b/conformance/results/pyright/directives_reveal_type.toml new file mode 100644 index 000000000..aa4078ead --- /dev/null +++ b/conformance/results/pyright/directives_reveal_type.toml @@ -0,0 +1,9 @@ +conformant = "Pass" +output = """ +directives_reveal_type.py:14:17 - information: Type of "a" is "int | str" +directives_reveal_type.py:15:17 - information: Type of "b" is "list[int]" +directives_reveal_type.py:16:17 - information: Type of "c" is "Any" +directives_reveal_type.py:17:17 - information: Type of "d" is "ForwardReference" +directives_reveal_type.py:19:5 - error: Expected a single positional argument for "reveal_type" call +directives_reveal_type.py:20:5 - error: Expected a single positional argument for "reveal_type" call +""" diff --git a/conformance/results/pyright/directives_type_checking.toml b/conformance/results/pyright/directives_type_checking.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/pyright/directives_type_checking.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/pyright/directives_type_ignore.toml b/conformance/results/pyright/directives_type_ignore.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/pyright/directives_type_ignore.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/pyright/directives_type_ignore_file1.toml b/conformance/results/pyright/directives_type_ignore_file1.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/pyright/directives_type_ignore_file1.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/pyright/directives_type_ignore_file2.toml b/conformance/results/pyright/directives_type_ignore_file2.toml new file mode 100644 index 000000000..37ecf19c9 --- /dev/null +++ b/conformance/results/pyright/directives_type_ignore_file2.toml @@ -0,0 +1,5 @@ +conformant = "Pass" +output = """ +directives_type_ignore_file2.py:14:10 - error: Expression of type "Literal['']" cannot be assigned to declared type "int" +  "Literal['']" is incompatible with "int" (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/directives_version_platform.toml b/conformance/results/pyright/directives_version_platform.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/pyright/directives_version_platform.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/pyright/overloads_basic.toml b/conformance/results/pyright/overloads_basic.toml new file mode 100644 index 000000000..7d79eea21 --- /dev/null +++ b/conformance/results/pyright/overloads_basic.toml @@ -0,0 +1,8 @@ +conformant = "Pass" +output = """ +overloads_basic.py:37:1 - error: No overloads for "__getitem__" match the provided arguments (reportGeneralTypeIssues) +overloads_basic.py:37:1 - error: Argument of type "Literal['']" cannot be assigned to parameter "__s" of type "slice" in function "__getitem__" +  "Literal['']" is incompatible with "slice" (reportGeneralTypeIssues) +overloads_basic.py:63:5 - error: "func1" is marked as overload, but additional overloads are missing (reportGeneralTypeIssues) +overloads_basic.py:75:5 - error: "func2" is marked as overload, but no implementation is provided (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/protocols_class_objects.toml b/conformance/results/pyright/protocols_class_objects.toml new file mode 100644 index 000000000..8fa46e696 --- /dev/null +++ b/conformance/results/pyright/protocols_class_objects.toml @@ -0,0 +1,28 @@ +conformant = "Partial" +notes = """ +Incorrectly reports some class objects as incompatible with a protocol. +Fails to report some class objects as incompatible with a protocol. +""" +output = """ +protocols_class_objects.py:29:5 - error: Argument of type "type[Proto]" cannot be assigned to parameter "cls" of type "type[Proto]" in function "fun" +  "Proto" is not a concrete class type and cannot be assigned to type "type[Proto]" (reportGeneralTypeIssues) +protocols_class_objects.py:34:7 - error: Expression of type "type[Proto]" cannot be assigned to declared type "type[Proto]" +  "Proto" is not a concrete class type and cannot be assigned to type "type[Proto]" (reportGeneralTypeIssues) +protocols_class_objects.py:58:16 - error: Expression of type "type[ConcreteA]" cannot be assigned to declared type "ProtoA1" +  "type[type]" is incompatible with "type[ConcreteA]" +  "type[type]" is incompatible with "type[ConcreteA]" +  "method1" is an incompatible type +    Type "(self: ConcreteA, x: int) -> int" cannot be assigned to type "(x: int) -> int" +      Parameter name mismatch: "x" versus "self" +      Parameter 1: type "int" cannot be assigned to type "ConcreteA" +        "int" is incompatible with "ConcreteA" (reportGeneralTypeIssues) +protocols_class_objects.py:59:16 - error: Expression of type "type[ConcreteA]" cannot be assigned to declared type "ProtoA2" +  "type[type]" is incompatible with "type[ConcreteA]" +  "type[type]" is incompatible with "type[ConcreteA]" +  "method1" is an incompatible type +    Type "(self: ConcreteA, x: int) -> int" cannot be assigned to type "(obj: Any, x: int) -> int" +      Parameter name mismatch: "obj" versus "self" (reportGeneralTypeIssues) +protocols_class_objects.py:74:16 - error: Expression of type "type[ConcreteB]" cannot be assigned to declared type "ProtoB1" +  "prop1" is an incompatible type +    "property" is incompatible with "int" (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/protocols_definition.toml b/conformance/results/pyright/protocols_definition.toml new file mode 100644 index 000000000..bd9150093 --- /dev/null +++ b/conformance/results/pyright/protocols_definition.toml @@ -0,0 +1,89 @@ +conformant = "Partial" +notes = """ +Does not reject ClassVar in concrete class when attribute in protocol is not ClassVar. +""" +output = """ +protocols_definition.py:30:12 - error: Argument of type "list[int]" cannot be assigned to parameter "things" of type "Iterable[SupportsClose]" in function "close_all" +  "Literal[1]" is incompatible with protocol "SupportsClose" +    "close" is not present (reportGeneralTypeIssues) +protocols_definition.py:67:14 - error: Instance or class variables within a Protocol class must be explicitly declared within the class body +protocols_definition.py:115:22 - error: Expression of type "Concrete2_Bad1" cannot be assigned to declared type "Template2" +  "Concrete2_Bad1" is incompatible with protocol "Template2" +    "val1" is not present (reportGeneralTypeIssues) +protocols_definition.py:116:22 - error: Expression of type "Concrete2_Bad2" cannot be assigned to declared type "Template2" +  "Concrete2_Bad2" is incompatible with protocol "Template2" +    "val1" is invariant because it is mutable +    "val1" is an incompatible type +      "Sequence[float]" is incompatible with "Sequence[int]" (reportGeneralTypeIssues) +protocols_definition.py:117:22 - error: Expression of type "Concrete2_Bad3" cannot be assigned to declared type "Template2" +  "Concrete2_Bad3" is incompatible with protocol "Template2" +    "val1" is invariant because it is mutable +    "val1" is an incompatible type +      "list[int]" is incompatible with "Sequence[int]" (reportGeneralTypeIssues) +protocols_definition.py:156:22 - error: Expression of type "Concrete3_Bad1" cannot be assigned to declared type "Template3" +  "Concrete3_Bad1" is incompatible with protocol "Template3" +    "val1" is not present (reportGeneralTypeIssues) +protocols_definition.py:158:22 - error: Expression of type "Concrete3_Bad3" cannot be assigned to declared type "Template3" +  "Concrete3_Bad3" is incompatible with protocol "Template3" +    "val1" is invariant because it is mutable +    "val1" is an incompatible type +      "property" is incompatible with "Sequence[int]" (reportGeneralTypeIssues) +protocols_definition.py:159:22 - error: Expression of type "Concrete3_Bad4" cannot be assigned to declared type "Template3" +  "Concrete3_Bad4" is incompatible with protocol "Template3" +    "val1" is invariant because it is mutable +    "val1" is an incompatible type +      "Sequence[float]" is incompatible with "Sequence[int]" (reportGeneralTypeIssues) +protocols_definition.py:160:22 - error: Expression of type "Concrete3_Bad5" cannot be assigned to declared type "Template3" +  "Concrete3_Bad5" is incompatible with protocol "Template3" +    "val1" is invariant because it is mutable +    "val1" is an incompatible type +      "list[int]" is incompatible with "Sequence[int]" (reportGeneralTypeIssues) +protocols_definition.py:218:22 - error: Expression of type "Concrete4_Bad1" cannot be assigned to declared type "Template4" +  "Concrete4_Bad1" is incompatible with protocol "Template4" +    "val1" is an incompatible type +      "function" is incompatible with "Sequence[float]" (reportGeneralTypeIssues) +protocols_definition.py:219:22 - error: Expression of type "Concrete4_Bad2" cannot be assigned to declared type "Template4" +  "Concrete4_Bad2" is incompatible with protocol "Template4" +    "val1" is not present (reportGeneralTypeIssues) +protocols_definition.py:276:17 - warning: Static methods should not take a "self" or "cls" parameter (reportSelfClsParameterName) +protocols_definition.py:285:22 - error: Expression of type "Concrete5_Bad1" cannot be assigned to declared type "Template5" +  "Concrete5_Bad1" is incompatible with protocol "Template5" +    "method1" is an incompatible type +      Type "(a: Unknown, c: Unknown) -> int" cannot be assigned to type "(a: int, b: int) -> float" +        Parameter name mismatch: "b" versus "c" (reportGeneralTypeIssues) +protocols_definition.py:286:22 - error: Expression of type "Concrete5_Bad2" cannot be assigned to declared type "Template5" +  "Concrete5_Bad2" is incompatible with protocol "Template5" +    "method1" is an incompatible type +      Type "(a: int, c: int) -> int" cannot be assigned to type "(a: int, b: int) -> float" +        Parameter name mismatch: "b" versus "c" (reportGeneralTypeIssues) +protocols_definition.py:287:22 - error: Expression of type "Concrete5_Bad3" cannot be assigned to declared type "Template5" +  "Concrete5_Bad3" is incompatible with protocol "Template5" +    "method1" is an incompatible type +      Type "(*, a: int, b: int) -> float" cannot be assigned to type "(a: int, b: int) -> float" +        Function accepts too many positional parameters; expected 0 but received 2 +          Keyword parameter "a" is missing in destination +          Keyword parameter "b" is missing in destination (reportGeneralTypeIssues) +protocols_definition.py:288:22 - error: Expression of type "Concrete5_Bad4" cannot be assigned to declared type "Template5" +  "Concrete5_Bad4" is incompatible with protocol "Template5" +    "method1" is an incompatible type +      Type "(a: int, b: int, /) -> float" cannot be assigned to type "(a: int, b: int) -> float" +        Position-only parameter mismatch; parameter "a" is not position-only +        Position-only parameter mismatch; parameter "b" is not position-only +        Position-only parameter mismatch; expected 2 but received 0 (reportGeneralTypeIssues) +protocols_definition.py:289:22 - error: Expression of type "Concrete5_Bad5" cannot be assigned to declared type "Template5" +  "Concrete5_Bad5" is incompatible with protocol "Template5" +    "method1" is an incompatible type +      Type "(self: Unknown, a: int, b: int) -> float" cannot be assigned to type "(a: int, b: int) -> float" +        Parameter name mismatch: "a" versus "self" +        Parameter name mismatch: "b" versus "a" (reportGeneralTypeIssues) +protocols_definition.py:339:22 - error: Expression of type "Concrete6_Bad1" cannot be assigned to declared type "Template6" +  "Concrete6_Bad1" is incompatible with protocol "Template6" +    "val1" is an incompatible type +      Property setter method is missing (reportGeneralTypeIssues) +protocols_definition.py:340:22 - error: Expression of type "Concrete6_Bad2" cannot be assigned to declared type "Template6" +  "Concrete6_Bad2" is incompatible with protocol "Template6" +    "val1" is writable in protocol (reportGeneralTypeIssues) +protocols_definition.py:341:22 - error: Expression of type "Concrete6_Bad3" cannot be assigned to declared type "Template6" +  "Concrete6_Bad3" is incompatible with protocol "Template6" +    "val1" is writable in protocol (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/protocols_explicit.toml b/conformance/results/pyright/protocols_explicit.toml new file mode 100644 index 000000000..bacc5d7d1 --- /dev/null +++ b/conformance/results/pyright/protocols_explicit.toml @@ -0,0 +1,26 @@ +conformant = "Partial" +notes = """ +Does not report error when calling unimplemented protocol method from derived class. +""" +output = """ +protocols_explicit.py:56:32 - error: Cannot assign member "rgb" for type "Point*" +  "str" is incompatible with "int" (reportGeneralTypeIssues) +protocols_explicit.py:54:7 - error: Class derives from one or more protocol classes but does not implement all required members +  Member "other" is declared in protocol class "RGB" +  Member "transparency" is declared in protocol class "RGB" (reportGeneralTypeIssues) +protocols_explicit.py:63:5 - error: Cannot instantiate abstract class "Point" +  "RGB.intensity" is abstract (reportGeneralTypeIssues) +protocols_explicit.py:86:7 - error: Class derives from one or more protocol classes but does not implement all required members +  Member "cm1" is declared in protocol class "Proto1" +  Member "im1" is declared in protocol class "Proto1" (reportGeneralTypeIssues) +protocols_explicit.py:103:7 - error: Class derives from one or more protocol classes but does not implement all required members +  Member "im1" is declared in protocol class "Proto1" +  Member "cm10" is declared in protocol class "Proto2" +  Member "cm11" is declared in protocol class "Proto3" (reportGeneralTypeIssues) +protocols_explicit.py:135:7 - error: Class derives from one or more protocol classes but does not implement all required members +  Member "method1" is declared in protocol class "Proto5" (reportGeneralTypeIssues) +protocols_explicit.py:166:7 - error: Class derives from one or more protocol classes but does not implement all required members +  Member "method1" is declared in protocol class "Proto7" (reportGeneralTypeIssues) +protocols_explicit.py:171:7 - error: Cannot instantiate abstract class "Concrete7A" +  "Proto7.method1" is abstract (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/protocols_generic.toml b/conformance/results/pyright/protocols_generic.toml new file mode 100644 index 000000000..d4972dc21 --- /dev/null +++ b/conformance/results/pyright/protocols_generic.toml @@ -0,0 +1,40 @@ +conformant = "Pass" +output = """ +protocols_generic.py:40:24 - error: Expression of type "Concrete1" cannot be assigned to declared type "Proto1[int, str]" +  "Concrete1" is incompatible with protocol "Proto1[int, str]" +    "method1" is an incompatible type +      Type "(x: str) -> str" cannot be assigned to type "(x: S@Proto1) -> S@Proto1" +        Parameter 1: type "S@Proto1" cannot be assigned to type "str" +          "int" is incompatible with "str" +        Function return type "str" is incompatible with type "S@Proto1" +          Type "str" cannot be assigned to type "int" +    "__iter__" is an incompatible type + ... (reportGeneralTypeIssues) +protocols_generic.py:44:30 - error: Only one Generic[...] or Protocol[...] base class allowed (reportGeneralTypeIssues) +protocols_generic.py:56:20 - error: Expression of type "Box[float]" cannot be assigned to declared type "Box[int]" +  "Box[float]" is incompatible with "Box[int]" +    Type parameter "T_co@Box" is covariant, but "float" is not a subtype of "int" +      "float" is incompatible with "int" (reportGeneralTypeIssues) +protocols_generic.py:66:25 - error: Expression of type "Sender[int]" cannot be assigned to declared type "Sender[float]" +  "Sender[int]" is incompatible with "Sender[float]" +    Type parameter "T_contra@Sender" is contravariant, but "int" is not a supertype of "float" +      "float" is incompatible with "int" (reportGeneralTypeIssues) +protocols_generic.py:74:28 - error: Expression of type "AttrProto[int]" cannot be assigned to declared type "AttrProto[float]" +  "AttrProto[int]" is incompatible with "AttrProto[float]" +    Type parameter "T@AttrProto" is invariant, but "int" is not the same as "float" (reportGeneralTypeIssues) +protocols_generic.py:75:26 - error: Expression of type "AttrProto[float]" cannot be assigned to declared type "AttrProto[int]" +  "AttrProto[float]" is incompatible with "AttrProto[int]" +    Type parameter "T@AttrProto" is invariant, but "float" is not the same as "int" (reportGeneralTypeIssues) +protocols_generic.py:146:25 - error: Expression of type "ConcreteHasProperty3" cannot be assigned to declared type "HasPropertyProto" +  "ConcreteHasProperty3" is incompatible with protocol "HasPropertyProto" +    "f" is an incompatible type +      Type "() -> int" cannot be assigned to type "() -> HasPropertyProto" +        Function return type "int" is incompatible with type "HasPropertyProto" +          "int" is incompatible with protocol "HasPropertyProto" (reportGeneralTypeIssues) +protocols_generic.py:147:25 - error: Expression of type "ConcreteHasProperty4" cannot be assigned to declared type "HasPropertyProto" +  "ConcreteHasProperty4" is incompatible with protocol "HasPropertyProto" +    "m" is an incompatible type +      Type "(item: str, callback: (int) -> str) -> str" cannot be assigned to type "(item: T@m, callback: (T@m) -> str) -> str" +        Parameter 2: type "(T@m) -> str" cannot be assigned to type "(int) -> str" +          Type "(str) -> str" cannot be assigned to type "(int) -> str" (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/protocols_merging.toml b/conformance/results/pyright/protocols_merging.toml new file mode 100644 index 000000000..3a1308853 --- /dev/null +++ b/conformance/results/pyright/protocols_merging.toml @@ -0,0 +1,16 @@ +conformant = "Pass" +output = """ +protocols_merging.py:52:25 - error: Expression of type "SCConcrete2" cannot be assigned to declared type "SizedAndClosable1" +  "SCConcrete2" is incompatible with protocol "SizedAndClosable1" +    "__len__" is not present (reportGeneralTypeIssues) +protocols_merging.py:53:25 - error: Expression of type "SCConcrete2" cannot be assigned to declared type "SizedAndClosable2" +  "SCConcrete2" is incompatible with protocol "SizedAndClosable2" +    "__len__" is not present (reportGeneralTypeIssues) +protocols_merging.py:54:25 - error: Expression of type "SCConcrete2" cannot be assigned to declared type "SizedAndClosable3" +  "SCConcrete2" is incompatible with "SizedAndClosable3" (reportGeneralTypeIssues) +protocols_merging.py:68:16 - error: Protocol class "type[BadProto]" cannot derive from non-protocol class "type[SizedAndClosable3]" +protocols_merging.py:83:5 - error: Cannot instantiate abstract class "SizedAndClosable4" +  "SizedAndClosable4.close" is abstract (reportGeneralTypeIssues) +protocols_merging.py:84:24 - error: Expression of type "SCConcrete1" cannot be assigned to declared type "SizedAndClosable4" +  "SCConcrete1" is incompatible with "SizedAndClosable4" (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/protocols_modules.toml b/conformance/results/pyright/protocols_modules.toml new file mode 100644 index 000000000..caf8f7ae3 --- /dev/null +++ b/conformance/results/pyright/protocols_modules.toml @@ -0,0 +1,14 @@ +conformant = "Pass" +output = """ +protocols_modules.py:26:17 - error: Expression of type "Module("_protocols_modules1")" cannot be assigned to declared type "Options2" +  "timeout" is invariant because it is mutable +  "timeout" is an incompatible type +    "int" is incompatible with "str" (reportGeneralTypeIssues) +protocols_modules.py:48:18 - error: Expression of type "Module("_protocols_modules2")" cannot be assigned to declared type "Reporter2" +  "on_error" is an incompatible type +    Type "(x: int) -> None" cannot be assigned to type "(x: int) -> int" +      Function return type "None" is incompatible with type "int" +        "None" is incompatible with "int" (reportGeneralTypeIssues) +protocols_modules.py:49:18 - error: Expression of type "Module("_protocols_modules2")" cannot be assigned to declared type "Reporter3" +  "not_implemented" is not present (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/protocols_recursive.toml b/conformance/results/pyright/protocols_recursive.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/pyright/protocols_recursive.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/pyright/protocols_runtime_checkable.toml b/conformance/results/pyright/protocols_runtime_checkable.toml new file mode 100644 index 000000000..de9c7e8d0 --- /dev/null +++ b/conformance/results/pyright/protocols_runtime_checkable.toml @@ -0,0 +1,9 @@ +conformant = "Partial" +notes = """ +Does not reject issubclass call for data protocol. +Does not report unsafe overlap for runtime_checkable protocol. +""" +output = """ +protocols_runtime_checkable.py:23:22 - error: Second argument to "isinstance" must be a class or tuple of classes +  Protocol class must be @runtime_checkable to be used with instance and class checks (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/protocols_self.toml b/conformance/results/pyright/protocols_self.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/pyright/protocols_self.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/pyright/protocols_subtyping.toml b/conformance/results/pyright/protocols_subtyping.toml new file mode 100644 index 000000000..24f807b22 --- /dev/null +++ b/conformance/results/pyright/protocols_subtyping.toml @@ -0,0 +1,25 @@ +conformant = "Pass" +output = """ +protocols_subtyping.py:16:6 - error: Cannot instantiate protocol class "Proto1" (reportGeneralTypeIssues) +protocols_subtyping.py:38:21 - error: Expression of type "Proto2" cannot be assigned to declared type "Concrete2" +  "Proto2" is incompatible with "Concrete2" (reportGeneralTypeIssues) +protocols_subtyping.py:55:18 - error: Expression of type "Proto2" cannot be assigned to declared type "Proto3" +  "Proto2" is incompatible with protocol "Proto3" +    "method2" is not present (reportGeneralTypeIssues) +protocols_subtyping.py:79:30 - error: Expression of type "Proto5[int]" cannot be assigned to declared type "Proto4[int, float]" +  "Proto5[int]" is incompatible with protocol "Proto4[int, float]" +    Type parameter "T@Proto4" is invariant, but "int" is not the same as "float" (reportGeneralTypeIssues) +protocols_subtyping.py:80:25 - error: Expression of type "Proto4[int, int]" cannot be assigned to declared type "Proto5[float]" +  "Proto4[int, int]" is incompatible with protocol "Proto5[float]" +    Type parameter "T@Proto5" is invariant, but "int" is not the same as "float" (reportGeneralTypeIssues) +protocols_subtyping.py:102:30 - error: Expression of type "Proto6[float, float]" cannot be assigned to declared type "Proto7[int, float]" +  "Proto6[float, float]" is incompatible with protocol "Proto7[int, float]" +    "method1" is an incompatible type +      Type "(a: float) -> Sequence[float]" cannot be assigned to type "(a: T_contra@Proto7) -> Sequence[S_co@Proto7]" +        Function return type "Sequence[float]" is incompatible with type "Sequence[S_co@Proto7]" +          "Sequence[float]" is incompatible with "Sequence[S_co@Proto7]" (reportGeneralTypeIssues) +protocols_subtyping.py:103:33 - error: Expression of type "Proto6[float, float]" cannot be assigned to declared type "Proto7[float, object]" +  "Proto6[float, float]" is incompatible with protocol "Proto7[float, object]" +    Type parameter "T_contra@Proto7" is contravariant, but "float" is not a supertype of "object" +      "object" is incompatible with "float" (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/protocols_variance.toml b/conformance/results/pyright/protocols_variance.toml new file mode 100644 index 000000000..383e67a2c --- /dev/null +++ b/conformance/results/pyright/protocols_variance.toml @@ -0,0 +1,16 @@ +conformant = "Partial" +notes = """ +Does not exempt "self" and "cls" parameters from variance checks. +""" +output = """ +protocols_variance.py:21:7 - warning: Type variable "T1" used in generic protocol "AnotherBox" should be covariant (reportInvalidTypeVarUse) +protocols_variance.py:40:7 - warning: Type variable "T3" used in generic protocol "Protocol2" should be contravariant (reportInvalidTypeVarUse) +protocols_variance.py:56:7 - warning: Type variable "T1" used in generic protocol "Protocol4" should be contravariant (reportInvalidTypeVarUse) +protocols_variance.py:62:22 - error: Covariant type variable cannot be used in parameter type (reportGeneralTypeIssues) +protocols_variance.py:61:7 - warning: Type variable "T1_co" used in generic protocol "Protocol5" should be contravariant (reportInvalidTypeVarUse) +protocols_variance.py:66:7 - warning: Type variable "T1" used in generic protocol "Protocol6" should be covariant (reportInvalidTypeVarUse) +protocols_variance.py:72:21 - error: Contravariant type variable cannot be used in return type (reportGeneralTypeIssues) +protocols_variance.py:71:7 - warning: Type variable "T1_contra" used in generic protocol "Protocol7" should be covariant (reportInvalidTypeVarUse) +protocols_variance.py:104:7 - warning: Type variable "T1" used in generic protocol "Protocol12" should be covariant (reportInvalidTypeVarUse) +protocols_variance.py:110:7 - warning: Type variable "T1_contra" used in generic protocol "Protocol13" should be invariant (reportInvalidTypeVarUse) +""" diff --git a/conformance/results/pyright/qualifiers_annotated.toml b/conformance/results/pyright/qualifiers_annotated.toml new file mode 100644 index 000000000..820d04b68 --- /dev/null +++ b/conformance/results/pyright/qualifiers_annotated.toml @@ -0,0 +1,23 @@ +conformant = "Partial" +notes = """ +Does not reject all invalid type expressions within Annotated. +""" +output = """ +qualifiers_annotated.py:42:17 - error: Expected type expression but received "tuple[tuple[type[int], type[str]]]" (reportGeneralTypeIssues) +qualifiers_annotated.py:43:18 - error: Expected type expression but received "Generator[type[int], None, None]" (reportGeneralTypeIssues) +qualifiers_annotated.py:44:17 - error: Expected type expression but received "dict[str, str]" (reportGeneralTypeIssues) +qualifiers_annotated.py:44:17 - error: Dictionary expression not allowed in type annotation +qualifiers_annotated.py:45:17 - error: Call expression not allowed in type expression (reportGeneralTypeIssues) +qualifiers_annotated.py:46:17 - error: List expression not allowed in type annotation +  Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) +qualifiers_annotated.py:46:17 - error: Expected type expression but received "list[type[int]]" (reportGeneralTypeIssues) +qualifiers_annotated.py:47:17 - error: Ternary expression not allowed in type annotation +qualifiers_annotated.py:48:17 - error: "var1" is not defined (reportUndefinedVariable) +qualifiers_annotated.py:49:17 - error: Expected type expression but received "Literal[True]" (reportGeneralTypeIssues) +qualifiers_annotated.py:50:18 - error: Expected type expression but received "Literal[1]" (reportGeneralTypeIssues) +qualifiers_annotated.py:51:18 - error: Binary operator not allowed in type annotation +qualifiers_annotated.py:52:18 - error: Expected expression +qualifiers_annotated.py:52:18 - error: Tuple expression not allowed in type annotation +  Use Tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type (reportGeneralTypeIssues) +qualifiers_annotated.py:62:8 - error: Expected one type argument and one or more annotations for "Annotated" +""" diff --git a/conformance/results/pyright/qualifiers_final_annotation.toml b/conformance/results/pyright/qualifiers_final_annotation.toml new file mode 100644 index 000000000..ee0ee3729 --- /dev/null +++ b/conformance/results/pyright/qualifiers_final_annotation.toml @@ -0,0 +1,38 @@ +conformant = "Partial" +notes = """ +Does not treat use of Final name as if it was replaced by the literal in NamedTuple definition. +""" +output = """ +qualifiers_final_annotation.py:18:7 - error: Expected a single type argument after "Final" +qualifiers_final_annotation.py:54:14 - error: Cannot assign member "ID5" for type "ClassA*" +  Member "ID5" cannot be assigned through a class instance because it is a ClassVar +    Member "__set__" is unknown (reportGeneralTypeIssues) +qualifiers_final_annotation.py:62:19 - error: "Final" is not allowed in this context +qualifiers_final_annotation.py:63:19 - error: "Final" is not allowed in this context +qualifiers_final_annotation.py:65:14 - error: Cannot assign member "ID7" for type "ClassA*" +  Member "ID7" cannot be assigned through a class instance because it is a ClassVar +  "ID7" is declared as Final and cannot be reassigned +    Member "__set__" is unknown (reportGeneralTypeIssues) +qualifiers_final_annotation.py:67:14 - error: Cannot assign member "ID7" for type "ClassA*" +  Member "ID7" cannot be assigned through a class instance because it is a ClassVar +  "ID7" is declared as Final and cannot be reassigned +    Member "__set__" is unknown (reportGeneralTypeIssues) +qualifiers_final_annotation.py:81:8 - error: Cannot assign member "DEFAULT_ID" for type "type[ClassB]" +  "DEFAULT_ID" is declared as Final and cannot be reassigned +    Member "__set__" is unknown (reportGeneralTypeIssues) +qualifiers_final_annotation.py:94:5 - error: "BORDER_WIDTH" cannot be redeclared because parent class "ClassC" declares it as Final +qualifiers_final_annotation.py:107:22 - error: "Final" is not allowed in this context +qualifiers_final_annotation.py:108:19 - error: "ClassVar" is not allowed in this context +qualifiers_final_annotation.py:118:9 - error: "Final" is not allowed in this context +qualifiers_final_annotation.py:121:14 - error: "Final" is not allowed in this context +qualifiers_final_annotation.py:145:5 - error: "x" is declared as Final and cannot be reassigned (reportGeneralTypeIssues) +qualifiers_final_annotation.py:147:10 - error: "x" is declared as Final and cannot be reassigned (reportGeneralTypeIssues) +qualifiers_final_annotation.py:149:9 - error: "x" is declared as Final and cannot be reassigned (reportGeneralTypeIssues) +qualifiers_final_annotation.py:152:30 - error: "x" is declared as Final and cannot be reassigned (reportGeneralTypeIssues) +qualifiers_final_annotation.py:155:9 - error: "x" is declared as Final and cannot be reassigned (reportGeneralTypeIssues) +qualifiers_final_annotation.py:141:5 - error: "ID1" is declared as Final and cannot be reassigned +qualifiers_final_annotation.py:16:1 - error: "BAD1" is declared Final, but value is not assigned +qualifiers_final_annotation.py:71:1 - error: "RATE" is declared as Final and cannot be reassigned +qualifiers_final_annotation.py:34:5 - error: "ID2" is declared Final, but value is not assigned +qualifiers_final_annotation.py:38:5 - error: "ID3" is declared Final, but value is not assigned +""" diff --git a/conformance/results/pyright/qualifiers_final_decorator.toml b/conformance/results/pyright/qualifiers_final_decorator.toml new file mode 100644 index 000000000..2cce4fc8e --- /dev/null +++ b/conformance/results/pyright/qualifiers_final_decorator.toml @@ -0,0 +1,17 @@ +conformant = "Partial" +notes = """ +Does not report override of overloaded method marked @final. +Does not report error for non-method function marked @final. +Does not report error if overload is marked @final but implementation is not. +Does not report error in stub if first overload is not marked @final but subsequent ones are. +""" +output = """ +qualifiers_final_decorator.py:8:6 - warning: Import "_qualifiers_final_decorator" could not be resolved from source (reportMissingModuleSource) +qualifiers_final_decorator.py:21:16 - error: Base class "Base1" is marked final and cannot be subclassed +qualifiers_final_decorator.py:56:9 - error: Method "method1" cannot override final method defined in class "Base2" +qualifiers_final_decorator.py:60:9 - error: Method "method2" cannot override final method defined in class "Base2" +qualifiers_final_decorator.py:64:9 - error: Method "method3" cannot override final method defined in class "Base2" +qualifiers_final_decorator.py:118:9 - error: Method "method" overrides class "Base5_2" in an incompatible manner +  Positional parameter count mismatch; base method has 2, but override has 1 (reportIncompatibleMethodOverride) +qualifiers_final_decorator.py:118:9 - error: Method "method" cannot override final method defined in class "Base5_2" +""" diff --git a/conformance/results/pyright/specialtypes_any.toml b/conformance/results/pyright/specialtypes_any.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/pyright/specialtypes_any.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/pyright/specialtypes_never.toml b/conformance/results/pyright/specialtypes_never.toml new file mode 100644 index 000000000..f07b88931 --- /dev/null +++ b/conformance/results/pyright/specialtypes_never.toml @@ -0,0 +1,14 @@ +conformant = "Partial" +notes = """ +Does not reject NoReturn when used outside of return type annotation. +""" +output = """ +specialtypes_never.py:19:22 - error: Function with declared return type "NoReturn" cannot return "None" (reportGeneralTypeIssues) +specialtypes_never.py:85:21 - error: Expression of type "list[Never]" cannot be assigned to declared type "list[int]" +  "list[Never]" is incompatible with "list[int]" +    Type parameter "_T@list" is invariant, but "Never" is not the same as "int" +    Consider switching from "list" to "Sequence" which is covariant (reportGeneralTypeIssues) +specialtypes_never.py:104:12 - error: Expression of type "ClassC[Never]" cannot be assigned to return type "ClassC[U@func10]" +  "ClassC[Never]" is incompatible with "ClassC[U@func10]" +    Type parameter "T@ClassC" is invariant, but "Never" is not the same as "U@func10" (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/specialtypes_none.toml b/conformance/results/pyright/specialtypes_none.toml new file mode 100644 index 000000000..bbb453938 --- /dev/null +++ b/conformance/results/pyright/specialtypes_none.toml @@ -0,0 +1,10 @@ +conformant = "Pass" +output = """ +specialtypes_none.py:21:7 - error: Argument of type "type[None]" cannot be assigned to parameter "val1" of type "None" in function "func1" +  "type[type]" is incompatible with "type[None]" (reportGeneralTypeIssues) +specialtypes_none.py:27:19 - error: Expression of type "None" cannot be assigned to declared type "Iterable[Unknown]" +  "None" is incompatible with protocol "Iterable[Unknown]" +    "__iter__" is not present (reportGeneralTypeIssues) +specialtypes_none.py:41:7 - error: Argument of type "None" cannot be assigned to parameter "val1" of type "type[None]" in function "func2" +  Type "None" cannot be assigned to type "type[None]" (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/specialtypes_promotions.toml b/conformance/results/pyright/specialtypes_promotions.toml new file mode 100644 index 000000000..18006b2cd --- /dev/null +++ b/conformance/results/pyright/specialtypes_promotions.toml @@ -0,0 +1,5 @@ +conformant = "Pass" +output = """ +specialtypes_promotions.py:13:7 - error: Cannot access member "numerator" for type "float" +  Member "numerator" is unknown (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/specialtypes_tuple.toml b/conformance/results/pyright/specialtypes_tuple.toml new file mode 100644 index 000000000..43cfc580b --- /dev/null +++ b/conformance/results/pyright/specialtypes_tuple.toml @@ -0,0 +1,22 @@ +conformant = "Pass" +output = """ +specialtypes_tuple.py:12:6 - error: Expression of type "tuple[Literal[1], Literal[2]]" cannot be assigned to declared type "tuple[int]" +  "tuple[Literal[1], Literal[2]]" is incompatible with "tuple[int]" +    Tuple size mismatch; expected 1 but received 2 (reportGeneralTypeIssues) +specialtypes_tuple.py:14:6 - error: Expression of type "tuple[Literal[1]]" cannot be assigned to declared type "tuple[int, int]" +  "tuple[Literal[1]]" is incompatible with "tuple[int, int]" +    Tuple size mismatch; expected 2 but received 1 (reportGeneralTypeIssues) +specialtypes_tuple.py:15:10 - error: Expression of type "tuple[Literal[1], Literal['']]" cannot be assigned to declared type "tuple[int, int]" +  "Literal['']" is incompatible with "int" (reportGeneralTypeIssues) +specialtypes_tuple.py:25:7 - error: Expression of type "tuple[Literal[1]]" cannot be assigned to declared type "tuple[()]" +  "tuple[Literal[1]]" is incompatible with "tuple[()]" +    Tuple size mismatch; expected 0 but received 1 (reportGeneralTypeIssues) +specialtypes_tuple.py:36:17 - error: Expression of type "tuple[Literal[1], Literal[2], Literal[3], Literal['']]" cannot be assigned to declared type "tuple[int, ...]" +  "Literal['']" is incompatible with "int" (reportGeneralTypeIssues) +specialtypes_tuple.py:42:22 - error: Expression of type "tuple[int, ...]" cannot be assigned to declared type "tuple[int]" +  "tuple[int, ...]" is incompatible with "tuple[int]" +    Tuple size mismatch; expected 1 but received indeterminate (reportGeneralTypeIssues) +specialtypes_tuple.py:43:21 - error: Expression of type "tuple[int, ...]" cannot be assigned to declared type "tuple[()]" +  "tuple[int, ...]" is incompatible with "tuple[()]" +    Tuple size mismatch; expected 0 but received indeterminate (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/specialtypes_tuple_unpack.toml b/conformance/results/pyright/specialtypes_tuple_unpack.toml new file mode 100644 index 000000000..3a59fbdf4 --- /dev/null +++ b/conformance/results/pyright/specialtypes_tuple_unpack.toml @@ -0,0 +1,29 @@ +conformant = "Pass" +output = """ +specialtypes_tuple_unpack.py:7:6 - error: Expression of type "tuple[Literal[1], Literal[''], Literal['']]" cannot be assigned to declared type "tuple[int, str]" +  "tuple[Literal[1], Literal[''], Literal['']]" is incompatible with "tuple[int, str]" +    Tuple size mismatch; expected 2 but received 3 (reportGeneralTypeIssues) +specialtypes_tuple_unpack.py:12:10 - error: Expression of type "tuple[Literal[1], Literal[1], Literal['']]" cannot be assigned to declared type "tuple[int, *tuple[str, ...]]" +  "Literal[1]" is incompatible with "str" (reportGeneralTypeIssues) +specialtypes_tuple_unpack.py:13:14 - error: Expression of type "tuple[Literal[1], Literal[''], Literal[1]]" cannot be assigned to declared type "tuple[int, *tuple[str, ...]]" +  "Literal[1]" is incompatible with "str" (reportGeneralTypeIssues) +specialtypes_tuple_unpack.py:19:14 - error: Expression of type "tuple[Literal[1], Literal[''], Literal['']]" cannot be assigned to declared type "tuple[int, *tuple[str, ...], int]" +  "Literal['']" is incompatible with "int" (reportGeneralTypeIssues) +specialtypes_tuple_unpack.py:20:18 - error: Expression of type "tuple[Literal[1], Literal[''], Literal[''], float]" cannot be assigned to declared type "tuple[int, *tuple[str, ...], int]" +  "float" is incompatible with "int" (reportGeneralTypeIssues) +specialtypes_tuple_unpack.py:25:7 - error: Expression of type "tuple[Literal[1], Literal[''], Literal[1]]" cannot be assigned to declared type "tuple[*tuple[str, ...], int]" +  "Literal[1]" is incompatible with "str" (reportGeneralTypeIssues) +specialtypes_tuple_unpack.py:26:15 - error: Expression of type "tuple[Literal[''], Literal[''], float]" cannot be assigned to declared type "tuple[*tuple[str, ...], int]" +  "float" is incompatible with "int" (reportGeneralTypeIssues) +specialtypes_tuple_unpack.py:28:25 - error: Type argument list can have at most one unpacked TypeVarTuple or Tuple +specialtypes_tuple_unpack.py:29:30 - error: Type argument list can have at most one unpacked TypeVarTuple or Tuple +specialtypes_tuple_unpack.py:34:40 - error: Expression of type "tuple[str, str]" cannot be assigned to declared type "tuple[str, str, int]" +  "tuple[str, str]" is incompatible with "tuple[str, str, int]" +    Tuple size mismatch; expected 3 but received 2 (reportGeneralTypeIssues) +specialtypes_tuple_unpack.py:37:50 - error: Expression of type "tuple[str, str]" cannot be assigned to declared type "tuple[str, str, str, *tuple[str, ...]]" +  "tuple[str, str]" is incompatible with "tuple[str, str, str, *tuple[str, ...]]" +    Tuple size mismatch; expected 4 but received 2 (reportGeneralTypeIssues) +specialtypes_tuple_unpack.py:41:50 - error: Expression of type "tuple[str, str]" cannot be assigned to declared type "tuple[*tuple[str, ...], str, str, str]" +  "tuple[str, str]" is incompatible with "tuple[*tuple[str, ...], str, str, str]" +    Tuple size mismatch; expected 4 but received 2 (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/specialtypes_type.toml b/conformance/results/pyright/specialtypes_type.toml new file mode 100644 index 000000000..985cf8dc3 --- /dev/null +++ b/conformance/results/pyright/specialtypes_type.toml @@ -0,0 +1,25 @@ +conformant = "Partial" +notes = """ +Does not reject Callable when passed to type[T]. +""" +output = """ +specialtypes_type.py:56:7 - error: Argument of type "type[TeamUser]" cannot be assigned to parameter "user_class" of type "type[BasicUser] | type[ProUser]" in function "func4" +  Type "type[TeamUser]" cannot be assigned to type "type[BasicUser] | type[ProUser]" +    "type[TeamUser]" is incompatible with "type[BasicUser]" +    Type "type[TeamUser]" cannot be assigned to type "type[BasicUser]" +    "type[TeamUser]" is incompatible with "type[ProUser]" +    Type "type[TeamUser]" cannot be assigned to type "type[ProUser]" (reportGeneralTypeIssues) +specialtypes_type.py:76:22 - error: Too many type arguments provided for "type"; expected 1 but received 2 +specialtypes_type.py:117:7 - error: Cannot access member "unknown" for type "type[object]" +  Member "unknown" is unknown (reportGeneralTypeIssues) +specialtypes_type.py:120:7 - error: Cannot access member "unknown" for type "type[object]" +  Member "unknown" is unknown (reportGeneralTypeIssues) +specialtypes_type.py:143:5 - error: Cannot access member "unknown" for type "TA1" +  Member "unknown" is unknown (reportGeneralTypeIssues) +specialtypes_type.py:144:5 - error: Cannot access member "unknown" for type "TA2" +  Member "unknown" is unknown (reportGeneralTypeIssues) +specialtypes_type.py:145:5 - error: Cannot access member "unknown" for type "TA3" +  Member "unknown" is unknown (reportGeneralTypeIssues) +specialtypes_type.py:146:5 - error: Cannot access member "unknown" for type "TA4" +  Member "unknown" is unknown (reportGeneralTypeIssues) +""" diff --git a/conformance/results/pyright/version.toml b/conformance/results/pyright/version.toml index 281a67b40..60b29ec76 100644 --- a/conformance/results/pyright/version.toml +++ b/conformance/results/pyright/version.toml @@ -1,2 +1,2 @@ -version = "pyright 1.1.343" -test_duration = 1.0995278358459473 +version = "pyright 1.1.344" +test_duration = 1.2410261631011963 diff --git a/conformance/results/pytype/annotations_coroutines.toml b/conformance/results/pytype/annotations_coroutines.toml new file mode 100644 index 000000000..7f77af071 --- /dev/null +++ b/conformance/results/pytype/annotations_coroutines.toml @@ -0,0 +1,9 @@ +conformant = "Partial" +notes = """ +Does not evaluate correct type for async function. +""" +output = """ +File "annotations_coroutines.py", line 19, in : Callable[[int], str] [assert-type] + Expected: Callable[[int], Coroutine[Any, Any, str]] + Actual: Callable[[int], str] +""" diff --git a/conformance/results/pytype/annotations_forward_refs.toml b/conformance/results/pytype/annotations_forward_refs.toml new file mode 100644 index 000000000..86a252c55 --- /dev/null +++ b/conformance/results/pytype/annotations_forward_refs.toml @@ -0,0 +1,45 @@ +conformant = "Partial" +notes = """ +Does not reject some illegal type expression forms when quoted. +Incorrectly generates error for quoted type defined in class scope. +Evaluates incorrect type for class variable annotated with quoted type expression. +""" +output = """ +File "annotations_forward_refs.py", line 22, in : Name 'ClassA' is not defined [name-error] +File "annotations_forward_refs.py", line 23, in : Name 'ClassA' is not defined [name-error] +File "annotations_forward_refs.py", line 24, in : unsupported operand type(s) for |: ''ClassA': str' and 'int: Type[int]' [unsupported-operands] + No attribute '__or__' on ''ClassA': str' or '__ror__' on 'int: Type[int]' +File "annotations_forward_refs.py", line 25, in : Missing parameter 'y' in call to function int.__or__ [missing-parameter] + Expected: (self, y) + Actually passed: (self) +File "annotations_forward_refs.py", line 40, in : invalid syntax [python-compiler-error] +File "annotations_forward_refs.py", line 40, in : Invalid type annotation '[int, str]' for p2 [invalid-annotation] + Not a type +File "annotations_forward_refs.py", line 40, in : Invalid type annotation '(int, str)' for p3 [invalid-annotation] + Not a type +File "annotations_forward_refs.py", line 40, in : Invalid type annotation '' for p4 [invalid-annotation] + Not a type +File "annotations_forward_refs.py", line 40, in : Invalid type annotation '{}' for p5 [invalid-annotation] + Not a type +File "annotations_forward_refs.py", line 40, in : Invalid type annotation '1' for p9 [invalid-annotation] + Not a type +File "annotations_forward_refs.py", line 40, in : Invalid type annotation 'True' for p10 [invalid-annotation] + Not a type +File "annotations_forward_refs.py", line 40, in : Invalid type annotation '1' for p11 [invalid-annotation] + Not a type +File "annotations_forward_refs.py", line 40, in : Invalid type annotation '-1' for p12 [invalid-annotation] + Not a type +File "annotations_forward_refs.py", line 40, in : Invalid type annotation '' for p15 [invalid-annotation] + Not a type +File "annotations_forward_refs.py", line 66, in ClassB: Name 'ClassB' is not defined [name-error] +File "annotations_forward_refs.py", line 80, in ClassD: Name 'ClassF' is not defined [name-error] +File "annotations_forward_refs.py", line 82, in ClassD: Invalid type annotation '' for str [invalid-annotation] + Must be constant +File "annotations_forward_refs.py", line 87, in ClassD: Invalid type annotation '' for x [invalid-annotation] + Not a type +File "annotations_forward_refs.py", line 89, in ClassD: Invalid type annotation '' for y [invalid-annotation] + Not a type +File "annotations_forward_refs.py", line 93, in : Any [assert-type] + Expected: int + Actual: Any +""" diff --git a/conformance/results/pytype/annotations_generators.toml b/conformance/results/pytype/annotations_generators.toml new file mode 100644 index 000000000..c08eb1d06 --- /dev/null +++ b/conformance/results/pytype/annotations_generators.toml @@ -0,0 +1,40 @@ +conformant = "Partial" +notes = """ +Does not report invalid return type for generator when function implicitly returns None. +Reports invalid error when return type of generator is annotated as a compatible protocol. +Does not report type violation in `yield from` statement. +""" +output = """ +File "annotations_generators.py", line 54, in generator2: bad return type [bad-return-type] + Expected: C + Actually returned: bool +File "annotations_generators.py", line 57, in generator2: bad return type [bad-return-type] + Expected: C + Actually returned: None +File "annotations_generators.py", line 57, in generator2: bad return type [bad-return-type] + Expected: A + Actually returned: int +File "annotations_generators.py", line 66, in generator3: bad return type [bad-return-type] + Expected: A + Actually returned: int +File "annotations_generators.py", line 75, in generator5: bad return type [bad-return-type] + Expected: A + Actually returned: B +File "annotations_generators.py", line 86, in : Bad return type 'int' for generator function generator8 [bad-yield-annotation] + Expected Generator, Iterable or Iterator +File "annotations_generators.py", line 91, in : Bad return type 'int' for async generator function generator9 [bad-yield-annotation] + Expected AsyncGenerator, AsyncIterable or AsyncIterator +File "annotations_generators.py", line 100, in : Bad return type 'IntIterator' for generator function generator15 [bad-yield-annotation] + Expected Generator, Iterable or Iterator +File "annotations_generators.py", line 109, in : Bad return type 'AsyncIntIterator' for async generator function generator16 [bad-yield-annotation] + Expected AsyncGenerator, AsyncIterable or AsyncIterator +File "annotations_generators.py", line 118, in generator18: bad return type [bad-return-type] + Expected: B + Actually returned: A +File "annotations_generators.py", line 119, in generator18: bad return type [bad-return-type] + Expected: B + Actually returned: A +File "annotations_generators.py", line 182, in : Callable[[], AsyncIterator[int]] [assert-type] + Expected: Callable[[], Coroutine[Any, Any, AsyncIterator[int]]] + Actual: Callable[[], AsyncIterator[int]] +""" diff --git a/conformance/results/pytype/annotations_methods.toml b/conformance/results/pytype/annotations_methods.toml new file mode 100644 index 000000000..8feb2032f --- /dev/null +++ b/conformance/results/pytype/annotations_methods.toml @@ -0,0 +1,9 @@ +conformant = "Pass" +notes = """ +Type evaluation differs from other type checkers because of ambiguity in the spec related to method bindings. +""" +output = """ +File "annotations_methods.py", line 42, in : B [assert-type] + Expected: A + Actual: B +""" diff --git a/conformance/results/pytype/annotations_typeexpr.toml b/conformance/results/pytype/annotations_typeexpr.toml index 6b91be0f3..6f76e031d 100644 --- a/conformance/results/pytype/annotations_typeexpr.toml +++ b/conformance/results/pytype/annotations_typeexpr.toml @@ -5,22 +5,25 @@ Does not reject call lambda expression in type annotation. Does not reject list expression in type annotation. Does not reject ternary expression in type annotation. Does not reject f-string in type annotation. +Does not reject module in type annotation. """ output = """ -File "annotations_typeexpr.py", line 76, in : Invalid type annotation '[int, str]' for p2 [invalid-annotation] +File "annotations_typeexpr.py", line 87, in : Invalid type annotation '[int, str]' for p2 [invalid-annotation] Not a type -File "annotations_typeexpr.py", line 76, in : Invalid type annotation '(int, str)' for p3 [invalid-annotation] +File "annotations_typeexpr.py", line 87, in : Invalid type annotation '(int, str)' for p3 [invalid-annotation] Not a type -File "annotations_typeexpr.py", line 76, in : Invalid type annotation '' for p4 [invalid-annotation] +File "annotations_typeexpr.py", line 87, in : Invalid type annotation '' for p4 [invalid-annotation] Not a type -File "annotations_typeexpr.py", line 76, in : Invalid type annotation '{}' for p5 [invalid-annotation] +File "annotations_typeexpr.py", line 87, in : Invalid type annotation '{}' for p5 [invalid-annotation] Not a type -File "annotations_typeexpr.py", line 76, in : Invalid type annotation '3' for p9 [invalid-annotation] +File "annotations_typeexpr.py", line 87, in : Invalid type annotation '3' for p9 [invalid-annotation] Not a type -File "annotations_typeexpr.py", line 76, in : Invalid type annotation 'True' for p10 [invalid-annotation] +File "annotations_typeexpr.py", line 87, in : Invalid type annotation 'True' for p10 [invalid-annotation] Not a type -File "annotations_typeexpr.py", line 76, in : Invalid type annotation '1' for p11 [invalid-annotation] +File "annotations_typeexpr.py", line 87, in : Invalid type annotation '1' for p11 [invalid-annotation] Not a type -File "annotations_typeexpr.py", line 76, in : Invalid type annotation '-1' for p12 [invalid-annotation] +File "annotations_typeexpr.py", line 87, in : Invalid type annotation '-1' for p12 [invalid-annotation] + Not a type +File "annotations_typeexpr.py", line 87, in : Invalid type annotation '' for p15 [invalid-annotation] Not a type """ diff --git a/conformance/results/pytype/classes_classvar.toml b/conformance/results/pytype/classes_classvar.toml new file mode 100644 index 000000000..38c3c84c1 --- /dev/null +++ b/conformance/results/pytype/classes_classvar.toml @@ -0,0 +1,45 @@ +conformant = "Partial" +notes = """ +Does not reject use of TypeVar in ClassVar. +Does not reject use of ParamSpec in ClassVar. +Does not reject use of ClassVar as a generic type argument. +Rejects initialization of ClassVar if no type argument is provided. +Does not reject use of ClassVar in parameter type annotation. +Does not reject use of ClassVar in local variable annotation. +Does not reject use of ClassVar in instance variable annotation. +Does not reject use of ClassVar in return type annotation. +Does not reject use of ClassVar in type alias definition. +Does not reject assignment of ClassVar through instance of class. +""" +output = """ +File "classes_classvar.py", line 7, in : typing.TypeVarTuple not supported yet [not-supported-yet] +File "classes_classvar.py", line 27, in : Function TypeVarTuple.__init__ expects 1 arg(s), got 2 [wrong-arg-count] + Expected: (self) + Actually passed: (self, _) +File "classes_classvar.py", line 33, in : Invalid type annotation 'Generic' [invalid-annotation] + Parameters to Generic[...] must all be type variables +File "classes_classvar.py", line 36, in ClassA: Invalid type annotation 'ClassVar[int, str]' [invalid-annotation] + ClassVar[_T] expected 1 parameter, got 2 +File "classes_classvar.py", line 37, in ClassA: class ClassVar is not indexable [not-indexable] +File "classes_classvar.py", line 38, in ClassA: Name 'var' is not defined [name-error] +File "classes_classvar.py", line 50, in ClassA: Type annotation for bad8 does not match type of assignment [annotation-type-mismatch] + Annotation: List[str] + Assignment: Dict[nothing, nothing] +File "classes_classvar.py", line 52, in ClassA: Name 'Final' is not defined [name-error] +File "classes_classvar.py", line 58, in ClassA: Type annotation for good4 does not match type of assignment [annotation-type-mismatch] + Annotation: ClassVar + Assignment: float +File "classes_classvar.py", line 66, in method2: bad return type [bad-return-type] + Expected: ClassVar[int] + Actually returned: int +File "classes_classvar.py", line 76, in : ClassVar [assert-type] + Expected: float + Actual: ClassVar +File "classes_classvar.py", line 119, in ProtoA: Type annotation for z does not match type of assignment [annotation-type-mismatch] + Annotation: ClassVar + Assignment: List[str] +File "classes_classvar.py", line 129, in : Type annotation for a does not match type of assignment [annotation-type-mismatch] + Annotation: ProtoA + Assignment: ProtoAImpl + Attributes of protocol ProtoA are not implemented on ProtoAImpl: z +""" diff --git a/conformance/results/pytype/classes_override.toml b/conformance/results/pytype/classes_override.toml new file mode 100644 index 000000000..dbce6db9f --- /dev/null +++ b/conformance/results/pytype/classes_override.toml @@ -0,0 +1,20 @@ +conformant = "Unsupported" +notes = """ +Does not yet support the @override decorator. +""" +output = """ +File "classes_override.py", line 7, in : typing.override not supported yet [not-supported-yet] + Import override from typing_extensions in Python versions before 3.12. +File "classes_override.py", line 30, in method2: bad return type [bad-return-type] + Expected: str + Actually returned: int +File "classes_override.py", line 50, in method2: bad return type [bad-return-type] + Expected: str + Actually returned: int +File "classes_override.py", line 53, in ChildA: Attribute 'method3' not found on any parent class [override-error] +File "classes_override.py", line 57, in ChildA: Attribute 'method4' not found on any parent class [override-error] +File "classes_override.py", line 66, in method4: bad return type [bad-return-type] + Expected: str + Actually returned: int +File "classes_override.py", line 103, in ChildB: Attribute 'method1' not found on any parent class [override-error] +""" diff --git a/conformance/results/pytype/directives_assert_type.toml b/conformance/results/pytype/directives_assert_type.toml new file mode 100644 index 000000000..caec764c9 --- /dev/null +++ b/conformance/results/pytype/directives_assert_type.toml @@ -0,0 +1,18 @@ +conformant = "Pass" +output = """ +File "directives_assert_type.py", line 27, in func1: Union[int, str] [assert-type] + Expected: int + Actual: Union[int, str] +File "directives_assert_type.py", line 28, in func1: Any [assert-type] + Expected: int + Actual: Any +File "directives_assert_type.py", line 31, in func1: Function assert_type expects 2 arg(s), got 0 [wrong-arg-count] + Expected: (variable, type) + Actually passed: () +File "directives_assert_type.py", line 32, in func1: str [assert-type] + Expected: int + Actual: str +File "directives_assert_type.py", line 33, in func1: Function assert_type expects 2 arg(s), got 3 [wrong-arg-count] + Expected: (variable, type) + Actually passed: (variable, type, _) +""" diff --git a/conformance/results/pytype/directives_cast.toml b/conformance/results/pytype/directives_cast.toml new file mode 100644 index 000000000..b971ffc15 --- /dev/null +++ b/conformance/results/pytype/directives_cast.toml @@ -0,0 +1,11 @@ +conformant = "Partial" +notes = """ +Does not reject a call to "cast" with additional arguments. +""" +output = """ +File "directives_cast.py", line 15, in : Missing parameter 'typ' in call to function typing.cast [missing-parameter] + Expected: (typ, val) + Actually passed: () +File "directives_cast.py", line 16, in : Invalid type annotation '1' for typing.cast [invalid-annotation] + Not a type +""" diff --git a/conformance/results/pytype/directives_no_type_check.toml b/conformance/results/pytype/directives_no_type_check.toml new file mode 100644 index 000000000..81bfe75b3 --- /dev/null +++ b/conformance/results/pytype/directives_no_type_check.toml @@ -0,0 +1,17 @@ +conformant = "Unsupported" +notes = """ +Does not honor @no_type_check decorator. +""" +output = """ +File "directives_no_type_check.py", line 16, in func1: unsupported operand type(s) for +: int and str [unsupported-operands] + Function __add__ on int expects int +File "directives_no_type_check.py", line 17, in func1: bad return type [bad-return-type] + Expected: None + Actually returned: int +File "directives_no_type_check.py", line 20, in : Function func1 was called with the wrong arguments [wrong-arg-types] + Expected: (a: int, ...) + Actually passed: (a: bytes, ...) +File "directives_no_type_check.py", line 21, in : Missing parameter 'a' in call to function func1 [missing-parameter] + Expected: (a, b) + Actually passed: () +""" diff --git a/conformance/results/pytype/directives_reveal_type.toml b/conformance/results/pytype/directives_reveal_type.toml new file mode 100644 index 000000000..814702713 --- /dev/null +++ b/conformance/results/pytype/directives_reveal_type.toml @@ -0,0 +1,12 @@ +conformant = "Partial" +notes = """ +Does not reject call to reveal_type with zero arguments. +Does not reject call to reveal_type with too many arguments. +""" +output = """ +File "directives_reveal_type.py", line 14, in func1: Union[int, str] [reveal-type] +File "directives_reveal_type.py", line 15, in func1: List[int] [reveal-type] +File "directives_reveal_type.py", line 16, in func1: Any [reveal-type] +File "directives_reveal_type.py", line 17, in func1: ForwardReference [reveal-type] +File "directives_reveal_type.py", line 20, in func1: Union[int, str] [reveal-type] +""" diff --git a/conformance/results/pytype/directives_type_checking.toml b/conformance/results/pytype/directives_type_checking.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/pytype/directives_type_checking.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/pytype/directives_type_ignore.toml b/conformance/results/pytype/directives_type_ignore.toml new file mode 100644 index 000000000..3e26df616 --- /dev/null +++ b/conformance/results/pytype/directives_type_ignore.toml @@ -0,0 +1,10 @@ +conformant = "Partial" +notes = """ +Does not honor "# type: ignore" comment if comment includes additional text. +""" +output = """ +File "directives_type_ignore.py", line 11: Stray type comment: ignore - additional stuff [ignored-type-comment] +File "directives_type_ignore.py", line 11, in : Type annotation for y does not match type of assignment [annotation-type-mismatch] + Annotation: int + Assignment: str +""" diff --git a/conformance/results/pytype/directives_type_ignore_file1.toml b/conformance/results/pytype/directives_type_ignore_file1.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/pytype/directives_type_ignore_file1.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/pytype/directives_type_ignore_file2.toml b/conformance/results/pytype/directives_type_ignore_file2.toml new file mode 100644 index 000000000..fe1d892b9 --- /dev/null +++ b/conformance/results/pytype/directives_type_ignore_file2.toml @@ -0,0 +1,6 @@ +conformant = "Partial" +notes = """ +Does not ignore `# type: ignore` if it occurs after docstrings in the file. +""" +output = """ +""" diff --git a/conformance/results/pytype/directives_version_platform.toml b/conformance/results/pytype/directives_version_platform.toml new file mode 100644 index 000000000..1128de03a --- /dev/null +++ b/conformance/results/pytype/directives_version_platform.toml @@ -0,0 +1,16 @@ +conformant = "Pass" +notes = """ +Does not understand three-element form of sys.version checks. +Does not understand os.name checks. +""" +output = """ +File "directives_version_platform.py", line 27, in : Type annotation for val3 does not match type of assignment [annotation-type-mismatch] + Annotation: int + Assignment: str +File "directives_version_platform.py", line 40, in : Type annotation for val7 does not match type of assignment [annotation-type-mismatch] + Annotation: int + Assignment: str +File "directives_version_platform.py", line 45, in : Type annotation for val8 does not match type of assignment [annotation-type-mismatch] + Annotation: int + Assignment: str +""" diff --git a/conformance/results/pytype/overloads_basic.toml b/conformance/results/pytype/overloads_basic.toml new file mode 100644 index 000000000..24e7a5708 --- /dev/null +++ b/conformance/results/pytype/overloads_basic.toml @@ -0,0 +1,16 @@ +conformant = "Partial" +notes = """ +Does not reject a function with a single @overload signature. +Does not reject a function with @overload signature but no implementation. +""" +output = """ +File "overloads_basic.py", line 31, in __getitem__: bad return type [bad-return-type] + Expected: int + Actually returned: bytes +File "overloads_basic.py", line 37, in : unsupported operand type(s) for item retrieval: Bytes and str [unsupported-operands] + Function __getitem__ on Bytes expects int +File "overloads_basic.py", line 58, in map: bad return type [bad-return-type] + Expected: Iterator + Actually returned: None + Attributes of protocol Iterator[S] are not implemented on None: __next__ +""" diff --git a/conformance/results/pytype/protocols_class_objects.toml b/conformance/results/pytype/protocols_class_objects.toml new file mode 100644 index 000000000..4d89ba6a3 --- /dev/null +++ b/conformance/results/pytype/protocols_class_objects.toml @@ -0,0 +1,8 @@ +conformant = "Partial" +notes = """ +Does not reject protocol class assigned to type[Proto]. +Incorrectly reports some class objects as incompatible with a protocol. +Fails to report some class objects as incompatible with a protocol. +""" +output = """ +""" diff --git a/conformance/results/pytype/protocols_definition.toml b/conformance/results/pytype/protocols_definition.toml new file mode 100644 index 000000000..aba256390 --- /dev/null +++ b/conformance/results/pytype/protocols_definition.toml @@ -0,0 +1,50 @@ +conformant = "Partial" +notes = """ +Reports errors for protocol static method with "..." implementation. +Does not report error when instance variable is set through "self" access in protocol class. +Does not report protocol mismatch when concrete class has attribute with covariant type and protocol attribute is mutable. +Does not reject ClassVar in concrete class when attribute in protocol is not ClassVar. +Does not reject read-only property in concrete class when attribute in protocol is mutable. +Does not reject covariant attribute type when protocol attribute is mutable. +Does not detect protocol mismatch if concrete method is missing annotations. +Does not detect protocol mismatch if concrete method's parameters are keyword-only. +Does not detect protocol mismatch if concrete method's parameters are position-only. +Does not detect protocol mismatch if concrete method is a classmethod. +Does not detect protocol mismatch if concrete method is a staticmethod. +Does not reject read-only property in concrete class when protocol has settable property. +Does not reject immutable named tuple attribute in concrete class when protocol attribute is mutable. +Does not reject immutable frozen dataclass attribute in concrete class when protocol attribute is mutable. +""" +output = """ +File "protocols_definition.py", line 30, in : Function close_all was called with the wrong arguments [wrong-arg-types] + Expected: (things: Iterable[SupportsClose]) + Actually passed: (things: List[int]) + Attributes of protocol SupportsClose are not implemented on int: close +File "protocols_definition.py", line 45, in third: bad return type [bad-return-type] + Expected: int + Actually returned: None +File "protocols_definition.py", line 115, in : Type annotation for v2_bad1 does not match type of assignment [annotation-type-mismatch] + Annotation: Template2 + Assignment: Concrete2_Bad1 + Attributes of protocol Template2 are not implemented on Concrete2_Bad1: val1 +File "protocols_definition.py", line 116, in : Type annotation for v2_bad2 does not match type of assignment [annotation-type-mismatch] + Annotation: Template2 + Assignment: Concrete2_Bad2 + Attribute val1 of protocol Template2 has wrong type in Concrete2_Bad2: expected Sequence[int], got Sequence[float] +File "protocols_definition.py", line 156, in : Type annotation for v3_bad1 does not match type of assignment [annotation-type-mismatch] + Annotation: Template3 + Assignment: Concrete3_Bad1 + Attributes of protocol Template3 are not implemented on Concrete3_Bad1: val1 +File "protocols_definition.py", line 159, in : Type annotation for v3_bad4 does not match type of assignment [annotation-type-mismatch] + Annotation: Template3 + Assignment: Concrete3_Bad4 + Attribute val1 of protocol Template3 has wrong type in Concrete3_Bad4: expected Sequence[int], got Sequence[float] +File "protocols_definition.py", line 218, in : Type annotation for v4_bad1 does not match type of assignment [annotation-type-mismatch] + Annotation: Template4 + Assignment: Concrete4_Bad1 + Attribute val1 of protocol Template4 has wrong type in Concrete4_Bad1: expected Sequence[float], got Callable[[Any], Sequence[int]] +File "protocols_definition.py", line 219, in : Type annotation for v4_bad2 does not match type of assignment [annotation-type-mismatch] + Annotation: Template4 + Assignment: Concrete4_Bad2 + Attributes of protocol Template4 are not implemented on Concrete4_Bad2: val1 +""" diff --git a/conformance/results/pytype/protocols_explicit.toml b/conformance/results/pytype/protocols_explicit.toml new file mode 100644 index 000000000..e2b080ebd --- /dev/null +++ b/conformance/results/pytype/protocols_explicit.toml @@ -0,0 +1,17 @@ +conformant = "Partial" +notes = """ +Reports errors for protocol static method with "..." implementation. +Does not report error when calling unimplemented protocol method from derived class. +Does not report type incompatibility when assigning to attribute defined in protocol. +Does not reject instantiation of class that derives from protocol but doesn't implement attribute. +Does not report instantiation of class that derives from protocol but doesn't implement method. +""" +output = """ +File "protocols_explicit.py", line 14, in draw: bad return type [bad-return-type] + Expected: str + Actually returned: None +Called from (traceback): + line 27, in draw +File "protocols_explicit.py", line 63, in : Can't instantiate Point with abstract methods intensity [not-instantiable] +File "protocols_explicit.py", line 171, in : Can't instantiate Concrete7A with abstract methods method1 [not-instantiable] +""" diff --git a/conformance/results/pytype/protocols_generic.toml b/conformance/results/pytype/protocols_generic.toml new file mode 100644 index 000000000..cfc64f916 --- /dev/null +++ b/conformance/results/pytype/protocols_generic.toml @@ -0,0 +1,36 @@ +conformant = "Partial" +notes = """ +Does not correctly enforce contravariance in protocol type compatibility tests. +Does not correctly enforce invariance in protocol type compatibility tests. +Does not detect protocol mismatch when method-scoped TypeVar is used in protocol. +""" +output = """ +File "protocols_generic.py", line 12, in : argument "covariant" to TypeVar not supported yet [not-supported-yet] +File "protocols_generic.py", line 13, in : argument "contravariant" to TypeVar not supported yet [not-supported-yet] +File "protocols_generic.py", line 40, in : Type annotation for p2 does not match type of assignment [annotation-type-mismatch] + Annotation: Proto1[int, str] + Assignment: Concrete1 + + Method __iter__ of protocol Proto1[int, str] has the wrong signature in Concrete1: + + >> Proto1[int, str] expects: + def __iter__(self) -> Iterator[T_co]: ... + + >> Concrete1 defines: + def __iter__(self) -> Iterator[int]: ... +File "protocols_generic.py", line 44, in : Invalid type annotation 'Proto2' [invalid-annotation] + Cannot inherit from Generic[...] multiple times +File "protocols_generic.py", line 56, in func1: Type annotation for v2 does not match type of assignment [annotation-type-mismatch] + Annotation: Box[int] + Assignment: Box[float] +File "protocols_generic.py", line 65, in func2: Type annotation for v1 does not match type of assignment [annotation-type-mismatch] + Annotation: Sender[int] + Assignment: Sender[float] +File "protocols_generic.py", line 75, in func3: Type annotation for v2 does not match type of assignment [annotation-type-mismatch] + Annotation: AttrProto[int] + Assignment: AttrProto[float] +File "protocols_generic.py", line 146, in : Type annotation for hp3 does not match type of assignment [annotation-type-mismatch] + Annotation: HasPropertyProto + Assignment: ConcreteHasProperty3 + Attribute f of protocol HasPropertyProto has wrong type in ConcreteHasProperty3: expected HasPropertyProto, got int +""" diff --git a/conformance/results/pytype/protocols_merging.toml b/conformance/results/pytype/protocols_merging.toml new file mode 100644 index 000000000..3b58f10d0 --- /dev/null +++ b/conformance/results/pytype/protocols_merging.toml @@ -0,0 +1,22 @@ +conformant = "Partial" +notes = """ +Does not reject a protocol class that derives from a non-protocol class. +Does not report attempt to instantiate abstract class downgraded from protocol class. +""" +output = """ +File "protocols_merging.py", line 52, in : Type annotation for s6 does not match type of assignment [annotation-type-mismatch] + Annotation: SizedAndClosable1 + Assignment: SCConcrete2 + Attributes of protocol SizedAndClosable1 are not implemented on SCConcrete2: __len__ +File "protocols_merging.py", line 53, in : Type annotation for s7 does not match type of assignment [annotation-type-mismatch] + Annotation: SizedAndClosable2 + Assignment: SCConcrete2 + Attributes of protocol SizedAndClosable2 are not implemented on SCConcrete2: __len__ +File "protocols_merging.py", line 54, in : Type annotation for s8 does not match type of assignment [annotation-type-mismatch] + Annotation: SizedAndClosable3 + Assignment: SCConcrete2 +File "protocols_merging.py", line 83, in : Can't instantiate SizedAndClosable4 with abstract methods close [not-instantiable] +File "protocols_merging.py", line 84, in : Type annotation for y does not match type of assignment [annotation-type-mismatch] + Annotation: SizedAndClosable4 + Assignment: SCConcrete1 +""" diff --git a/conformance/results/pytype/protocols_modules.toml b/conformance/results/pytype/protocols_modules.toml new file mode 100644 index 000000000..89249cd23 --- /dev/null +++ b/conformance/results/pytype/protocols_modules.toml @@ -0,0 +1,8 @@ +conformant = "Partial" +notes = """ +Does not report incompatibilities for protocol methods. +""" +output = """ +File "protocols_modules.py", line 10, in : Can't find module '_protocols_modules1'. [import-error] +File "protocols_modules.py", line 11, in : Can't find module '_protocols_modules2'. [import-error] +""" diff --git a/conformance/results/pytype/protocols_recursive.toml b/conformance/results/pytype/protocols_recursive.toml new file mode 100644 index 000000000..72190d322 --- /dev/null +++ b/conformance/results/pytype/protocols_recursive.toml @@ -0,0 +1,10 @@ +conformant = "Partial" +notes = """ +Incorrectly reports type error for some recursive protocols. +""" +output = """ +File "protocols_recursive.py", line 11, in : argument "contravariant" to TypeVar not supported yet [not-supported-yet] +File "protocols_recursive.py", line 80, in : Any [assert-type] + Expected: List[int] + Actual: Any +""" diff --git a/conformance/results/pytype/protocols_runtime_checkable.toml b/conformance/results/pytype/protocols_runtime_checkable.toml new file mode 100644 index 000000000..80197221f --- /dev/null +++ b/conformance/results/pytype/protocols_runtime_checkable.toml @@ -0,0 +1,8 @@ +conformant = "Unsupported" +notes = """ +Does not reject isinstance or issubclass call for protocol that is not runtime_checkable. +Does not reject issubclass call for data protocol. +Does not report unsafe overlap for runtime_checkable protocol. +""" +output = """ +""" diff --git a/conformance/results/pytype/protocols_self.toml b/conformance/results/pytype/protocols_self.toml new file mode 100644 index 000000000..42c875453 --- /dev/null +++ b/conformance/results/pytype/protocols_self.toml @@ -0,0 +1,29 @@ +conformant = "Partial" +notes = """ +Does not properly handle Self type within a protocol. +""" +output = """ +File "protocols_self.py", line 37, in : argument "covariant" to TypeVar not supported yet [not-supported-yet] +File "protocols_self.py", line 72, in : Type annotation for a2 does not match type of assignment [annotation-type-mismatch] + Annotation: P2Parent[str] + Assignment: C2[str] + + Method f0 of protocol P2Parent[str] has the wrong signature in C2[str]: + + >> P2Parent[str] expects: + def f0(self, right: Self, /) -> P2Parent[T1]: ... + + >> C2[str] defines: + def f0(self, other: Self) -> C2[T2_co]: ... +File "protocols_self.py", line 73, in : Type annotation for b2 does not match type of assignment [annotation-type-mismatch] + Annotation: P2Child[str] + Assignment: C2[str] + + Method f0 of protocol P2Child[str] has the wrong signature in C2[str]: + + >> P2Child[str] expects: + def f0(self, right: Self, /) -> P2Parent[T1]: ... + + >> C2[str] defines: + def f0(self, other: Self) -> C2[T2_co]: ... +""" diff --git a/conformance/results/pytype/protocols_subtyping.toml b/conformance/results/pytype/protocols_subtyping.toml new file mode 100644 index 000000000..915be92af --- /dev/null +++ b/conformance/results/pytype/protocols_subtyping.toml @@ -0,0 +1,16 @@ +conformant = "Partial" +notes = """ +Does not reject attempt to instantiate protocol class. +Does not report some protocol type compatibility violations involving contravariance. +""" +output = """ +File "protocols_subtyping.py", line 38, in func1: Type annotation for v2 does not match type of assignment [annotation-type-mismatch] + Annotation: Concrete2 + Assignment: Proto2 +File "protocols_subtyping.py", line 55, in func2: Type annotation for v2 does not match type of assignment [annotation-type-mismatch] + Annotation: Proto3 + Assignment: Proto2 + Attributes of protocol Proto3 are not implemented on Proto2: method2 +File "protocols_subtyping.py", line 83, in : argument "covariant" to TypeVar not supported yet [not-supported-yet] +File "protocols_subtyping.py", line 84, in : argument "contravariant" to TypeVar not supported yet [not-supported-yet] +""" diff --git a/conformance/results/pytype/protocols_variance.toml b/conformance/results/pytype/protocols_variance.toml new file mode 100644 index 000000000..58eec53df --- /dev/null +++ b/conformance/results/pytype/protocols_variance.toml @@ -0,0 +1,11 @@ +conformant = "Unsupported" +notes = """ +Does not detect incorrect TypeVar variance within generic protocols. +""" +output = """ +File "protocols_variance.py", line 12, in : argument "covariant" to TypeVar not supported yet [not-supported-yet] +File "protocols_variance.py", line 13, in : argument "contravariant" to TypeVar not supported yet [not-supported-yet] +File "protocols_variance.py", line 15, in : argument "covariant" to TypeVar not supported yet [not-supported-yet] +File "protocols_variance.py", line 84, in : Invalid type annotation 'Protocol' [invalid-annotation] + Parameters to Generic[...] must all be type variables +""" diff --git a/conformance/results/pytype/qualifiers_annotated.toml b/conformance/results/pytype/qualifiers_annotated.toml new file mode 100644 index 000000000..bf0534a02 --- /dev/null +++ b/conformance/results/pytype/qualifiers_annotated.toml @@ -0,0 +1,27 @@ +conformant = "Partial" +notes = """ +Does not reject some illegal type expression forms used in Annotated. +Does not allow TypeVar to be used in type alias when wrapped with Annotated. +""" +output = """ +File "qualifiers_annotated.py", line 10, in : typing.NotRequired not supported yet [not-supported-yet] +File "qualifiers_annotated.py", line 10, in : typing.Required not supported yet [not-supported-yet] +File "qualifiers_annotated.py", line 41, in : Invalid type annotation '[int, str]' for Bad1 [invalid-annotation] + Not a type +File "qualifiers_annotated.py", line 42, in : Invalid type annotation '((int, str),)' for Bad2 [invalid-annotation] + Not a type +File "qualifiers_annotated.py", line 43, in : Invalid type annotation '' for Bad3 [invalid-annotation] + Not a type +File "qualifiers_annotated.py", line 44, in : Invalid type annotation "{'a': 'b'}" for Bad4 [invalid-annotation] + Not a type +File "qualifiers_annotated.py", line 48, in : Name 'var1' is not defined [name-error] +File "qualifiers_annotated.py", line 49, in : Invalid type annotation 'True' for Bad9 [invalid-annotation] + Not a type +File "qualifiers_annotated.py", line 50, in : Invalid type annotation '1' for Bad10 [invalid-annotation] + Not a type +File "qualifiers_annotated.py", line 52, in : Invalid type annotation '' for Bad12 [invalid-annotation] + Must be constant +File "qualifiers_annotated.py", line 62, in : Invalid type annotation 'Annotated' [invalid-annotation] + typing.Annotated must have at least 1 annotation +File "qualifiers_annotated.py", line 96, in : Invalid TypeVar: TypeVar('T') must be stored as 'T', not 'TA3' [invalid-typevar] +""" diff --git a/conformance/results/pytype/qualifiers_final_annotation.toml b/conformance/results/pytype/qualifiers_final_annotation.toml new file mode 100644 index 000000000..c8996bfe2 --- /dev/null +++ b/conformance/results/pytype/qualifiers_final_annotation.toml @@ -0,0 +1,45 @@ +conformant = "Partial" +notes = """ +Does not report Final variable with missing initialization. +Does not reject Final instance variable declared outside of __init__ method. +Does not reject modification of global variable declared Final. +Does not reject modification of local variable declared Final. +""" +output = """ +File "qualifiers_final_annotation.py", line 18, in : Invalid type annotation 'Final[str, int]' [invalid-annotation] + Invalid type annotation 'Final' + typing.Final must wrap a single type +File "qualifiers_final_annotation.py", line 18, in : Invalid type annotation 'Final' [invalid-annotation] + typing.Final must wrap a single type +File "qualifiers_final_annotation.py", line 54, in __init__: Assigning to attribute ID5, which was annotated with Final [final-error] +File "qualifiers_final_annotation.py", line 65, in method1: Assigning to attribute ID7, which was annotated with Final [final-error] +File "qualifiers_final_annotation.py", line 67, in method1: Assigning to attribute ID7, which was annotated with Final [final-error] +File "qualifiers_final_annotation.py", line 71, in : Assigning to variable RATE, which was annotated with Final [final-error] +File "qualifiers_final_annotation.py", line 81, in : Assigning to attribute DEFAULT_ID, which was annotated with Final [final-error] +File "qualifiers_final_annotation.py", line 93, in : Class ClassCChild overrides final class attribute BORDER_WIDTH, defined in base class ClassC [final-error] +File "qualifiers_final_annotation.py", line 107, in ClassD: Invalid type annotation 'ClassVar[Final]' [invalid-annotation] + Invalid use of typing.Final + Final may only be used as the outermost type in assignments or variable annotations. +File "qualifiers_final_annotation.py", line 107, in ClassD: Invalid use of typing.Final [final-error] + Final may only be used as the outermost type in assignments or variable annotations. +File "qualifiers_final_annotation.py", line 107, in ClassD: Type annotation for VALUE2 does not match type of assignment [annotation-type-mismatch] + Annotation: Final + Assignment: int +File "qualifiers_final_annotation.py", line 108, in ClassD: Type annotation for VALUE3 does not match type of assignment [annotation-type-mismatch] + Annotation: ClassVar + Assignment: int +File "qualifiers_final_annotation.py", line 118, in : Invalid type annotation 'list[Final[int]]' [invalid-annotation] + Invalid use of typing.Final + Final may only be used as the outermost type in assignments or variable annotations. +File "qualifiers_final_annotation.py", line 118, in : Invalid use of typing.Final [final-error] + Final may only be used as the outermost type in assignments or variable annotations. +File "qualifiers_final_annotation.py", line 121, in : Invalid use of typing.Final [final-error] + Final may only be used as the outermost type in assignments or variable annotations. +File "qualifiers_final_annotation.py", line 134, in : Invalid keyword argument a to function N.__new__ [wrong-keyword-args] + Expected: (cls, x, y) + Actually passed: (cls, a) +File "qualifiers_final_annotation.py", line 135, in : Function N.__new__ was called with the wrong arguments [wrong-arg-types] + Expected: (cls, x: int, ...) + Actually passed: (cls, x: str, ...) +File "qualifiers_final_annotation.py", line 145, in func2: Assigning to variable x, which was annotated with Final [final-error] +""" diff --git a/conformance/results/pytype/qualifiers_final_decorator.toml b/conformance/results/pytype/qualifiers_final_decorator.toml new file mode 100644 index 000000000..852701ff5 --- /dev/null +++ b/conformance/results/pytype/qualifiers_final_decorator.toml @@ -0,0 +1,36 @@ +conformant = "Partial" +notes = """ +Does not report error for overloaded @final method defined in stub file. +Does not report error for overload that is marked @final when implementation is not. +""" +output = """ +File "qualifiers_final_decorator.py", line 8, in : Couldn't import pyi for '_qualifiers_final_decorator' [pyi-error] + File: "_qualifiers_final_decorator.pyi", line 8 + class Base3: + ^ + ParseError: Overloaded signatures for 'method' disagree on final decorators +File "qualifiers_final_decorator.py", line 21, in : Cannot subclass final class: Base1 [final-error] +File "qualifiers_final_decorator.py", line 52, in method4: bad return type [bad-return-type] + Expected: str + Actually returned: int +File "qualifiers_final_decorator.py", line 55, in : Class Derived2 overrides final method method3, defined in base class Base2 [final-error] +File "qualifiers_final_decorator.py", line 55, in : Class Derived2 overrides final method method1, defined in base class Base2 [final-error] +File "qualifiers_final_decorator.py", line 55, in : Class Derived2 overrides final method method2, defined in base class Base2 [final-error] +File "qualifiers_final_decorator.py", line 55, in : Class Derived2 overrides final method method4, defined in base class Base2 [final-error] +File "qualifiers_final_decorator.py", line 76, in method4: bad return type [bad-return-type] + Expected: str + Actually returned: int +File "qualifiers_final_decorator.py", line 90, in method: bad return type [bad-return-type] + Expected: str + Actually returned: int +File "qualifiers_final_decorator.py", line 103, in method: bad return type [bad-return-type] + Expected: str + Actually returned: int +File "qualifiers_final_decorator.py", line 117, in : Class Derived5 overrides final method method, defined in base class Base5_2 [final-error] +File "qualifiers_final_decorator.py", line 118, in Derived5: Overriding method signature mismatch [signature-mismatch] + Base signature: 'def Base5_2.method(self, v: int) -> None'. + Subclass signature: 'def Derived5.method(self) -> None'. + Not enough positional parameters in overriding method. +File "qualifiers_final_decorator.py", line 126, in : Cannot apply @final decorator to func1 [final-error] + @final can only be applied to classes and methods. +""" diff --git a/conformance/results/pytype/specialtypes_any.toml b/conformance/results/pytype/specialtypes_any.toml new file mode 100644 index 000000000..2146548eb --- /dev/null +++ b/conformance/results/pytype/specialtypes_any.toml @@ -0,0 +1,3 @@ +conformant = "Pass" +output = """ +""" diff --git a/conformance/results/pytype/specialtypes_never.toml b/conformance/results/pytype/specialtypes_never.toml new file mode 100644 index 000000000..c9b75df75 --- /dev/null +++ b/conformance/results/pytype/specialtypes_never.toml @@ -0,0 +1,22 @@ +conformant = "Unsupported" +notes = """ +Does not understand NoReturn or Never. +""" +output = """ +File "specialtypes_never.py", line 11, in : argument "covariant" to TypeVar not supported yet [not-supported-yet] +File "specialtypes_never.py", line 21, in func1: bad return type [bad-return-type] + Expected: Never + Actually returned: None +File "specialtypes_never.py", line 67, in func6: Type annotation for v1 does not match type of assignment [annotation-type-mismatch] + Annotation: int + Assignment: nothing +File "specialtypes_never.py", line 68, in func6: Type annotation for v2 does not match type of assignment [annotation-type-mismatch] + Annotation: str + Assignment: nothing +File "specialtypes_never.py", line 69, in func6: Type annotation for v3 does not match type of assignment [annotation-type-mismatch] + Annotation: List[str] + Assignment: nothing +File "specialtypes_never.py", line 85, in func8: Type annotation for v3 does not match type of assignment [annotation-type-mismatch] + Annotation: List[int] + Assignment: List[nothing] +""" diff --git a/conformance/results/pytype/specialtypes_none.toml b/conformance/results/pytype/specialtypes_none.toml new file mode 100644 index 000000000..e4e0cdbef --- /dev/null +++ b/conformance/results/pytype/specialtypes_none.toml @@ -0,0 +1,13 @@ +conformant = "Partial" +notes = """ +Does not detect type incompatibility between None and type[None]. +Does not detect type incompatibility between None and incompatible protocol. +""" +output = """ +File "specialtypes_none.py", line 21, in : Function func1 was called with the wrong arguments [wrong-arg-types] + Expected: (val1: None) + Actually passed: (val1: Type[None]) +File "specialtypes_none.py", line 41, in : Function func2 was called with the wrong arguments [wrong-arg-types] + Expected: (val1: Type[None]) + Actually passed: (val1: None) +""" diff --git a/conformance/results/pytype/specialtypes_promotions.toml b/conformance/results/pytype/specialtypes_promotions.toml new file mode 100644 index 000000000..91f796476 --- /dev/null +++ b/conformance/results/pytype/specialtypes_promotions.toml @@ -0,0 +1,4 @@ +conformant = "Pass" +output = """ +File "specialtypes_promotions.py", line 13, in func1: No attribute 'numerator' on float [attribute-error] +""" diff --git a/conformance/results/pytype/specialtypes_tuple.toml b/conformance/results/pytype/specialtypes_tuple.toml new file mode 100644 index 000000000..9ea092cae --- /dev/null +++ b/conformance/results/pytype/specialtypes_tuple.toml @@ -0,0 +1,21 @@ +conformant = "Partial" +notes = """ +Does not report type violation when assigning tuple[T, ...] to tuple[T]. +""" +output = """ +File "specialtypes_tuple.py", line 12, in : Type annotation for t1 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[int] + Assignment: Tuple[int, int] +File "specialtypes_tuple.py", line 14, in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[int, int] + Assignment: Tuple[int] +File "specialtypes_tuple.py", line 15, in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[int, int] + Assignment: Tuple[int, str] +File "specialtypes_tuple.py", line 25, in : Type annotation for t10 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[()] + Assignment: Tuple[int] +File "specialtypes_tuple.py", line 36, in : Type annotation for t20 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[int, ...] + Assignment: Tuple[int, int, int, str] +""" diff --git a/conformance/results/pytype/specialtypes_tuple_unpack.toml b/conformance/results/pytype/specialtypes_tuple_unpack.toml new file mode 100644 index 000000000..ce85f1715 --- /dev/null +++ b/conformance/results/pytype/specialtypes_tuple_unpack.toml @@ -0,0 +1,215 @@ +conformant = "Unsupported" +notes = """ +Does not support unpacked tuple in type expression. +""" +output = """ +File "specialtypes_tuple_unpack.py", line 6, in : Invalid type annotation 'tuple[int, *tuple[str]]' [invalid-annotation] + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type +File "specialtypes_tuple_unpack.py", line 6, in : Type annotation for t1 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[int, str] +File "specialtypes_tuple_unpack.py", line 6, in : Invalid type annotation '' [invalid-annotation] + Not a type +File "specialtypes_tuple_unpack.py", line 7, in : Type annotation for t1 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[int, str, str] +File "specialtypes_tuple_unpack.py", line 9, in : Invalid type annotation 'tuple[int, *tuple[str, ...]]' [invalid-annotation] + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type +File "specialtypes_tuple_unpack.py", line 9, in : Invalid type annotation '' [invalid-annotation] + Not a type +File "specialtypes_tuple_unpack.py", line 10, in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[int, str] +File "specialtypes_tuple_unpack.py", line 11, in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[int, str, str] +File "specialtypes_tuple_unpack.py", line 12, in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[int, int, str] +File "specialtypes_tuple_unpack.py", line 13, in : Type annotation for t2 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[int, str, int] +File "specialtypes_tuple_unpack.py", line 16, in : Invalid type annotation 'tuple[int, *tuple[str, ...], int]' [invalid-annotation] + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type +File "specialtypes_tuple_unpack.py", line 16, in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[int, int] +File "specialtypes_tuple_unpack.py", line 16, in : Invalid type annotation '' [invalid-annotation] + Not a type +File "specialtypes_tuple_unpack.py", line 17, in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[int, str, int] +File "specialtypes_tuple_unpack.py", line 18, in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[int, str, str, int] +File "specialtypes_tuple_unpack.py", line 19, in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[int, str, str] +File "specialtypes_tuple_unpack.py", line 20, in : Type annotation for t3 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[int, str, str, float] +File "specialtypes_tuple_unpack.py", line 22, in : Invalid type annotation 'tuple[*tuple[str, ...], int]' [invalid-annotation] + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type +File "specialtypes_tuple_unpack.py", line 22, in : Invalid type annotation '' [invalid-annotation] + Not a type +File "specialtypes_tuple_unpack.py", line 23, in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[str, int] +File "specialtypes_tuple_unpack.py", line 24, in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[str, str, int] +File "specialtypes_tuple_unpack.py", line 25, in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[int, str, int] +File "specialtypes_tuple_unpack.py", line 26, in : Type annotation for t4 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[str, str, float] +File "specialtypes_tuple_unpack.py", line 28, in : Function list.extend was called with the wrong arguments [wrong-arg-types] + Expected: (self, i: Iterable) + Actually passed: (self, i: Type[Tuple[int]]) + Attributes of protocol Iterable[_T2] are not implemented on type: __iter__ +File "specialtypes_tuple_unpack.py", line 28, in : Invalid type annotation '' [invalid-annotation] + Not a type +File "specialtypes_tuple_unpack.py", line 29, in : Function list.extend was called with the wrong arguments [wrong-arg-types] + Expected: (self, i: Iterable) + Actually passed: (self, i: Type[Tuple[int, ...]]) + Attributes of protocol Iterable[_T2] are not implemented on type: __iter__ +File "specialtypes_tuple_unpack.py", line 29, in : Invalid type annotation '' [invalid-annotation] + Not a type +File "specialtypes_tuple_unpack.py", line 33, in func1: Invalid type annotation 'tuple[str, str, *tuple[int, ...]]' [invalid-annotation] + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type +File "specialtypes_tuple_unpack.py", line 33, in func1: Type annotation for t1 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[str, str] +File "specialtypes_tuple_unpack.py", line 34, in func1: Invalid type annotation 'tuple[str, str, *tuple[int]]' [invalid-annotation] + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type +File "specialtypes_tuple_unpack.py", line 34, in func1: Type annotation for t2 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[str, str] +File "specialtypes_tuple_unpack.py", line 35, in func1: Invalid type annotation 'tuple[str, *tuple[str, ...]]' [invalid-annotation] + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type +File "specialtypes_tuple_unpack.py", line 35, in func1: Type annotation for t3 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[str, str] +File "specialtypes_tuple_unpack.py", line 36, in func1: Invalid type annotation 'tuple[str, str, *tuple[str, ...]]' [invalid-annotation] + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type +File "specialtypes_tuple_unpack.py", line 36, in func1: Type annotation for t4 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[str, str] +File "specialtypes_tuple_unpack.py", line 37, in func1: Invalid type annotation 'tuple[str, str, str, *tuple[str, ...]]' [invalid-annotation] + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type +File "specialtypes_tuple_unpack.py", line 37, in func1: Type annotation for t5 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[str, str] +File "specialtypes_tuple_unpack.py", line 38, in func1: Invalid type annotation 'tuple[str, *tuple[int, ...], str]' [invalid-annotation] + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type +File "specialtypes_tuple_unpack.py", line 38, in func1: Type annotation for t6 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[str, str] +File "specialtypes_tuple_unpack.py", line 39, in func1: Invalid type annotation 'tuple[*tuple[str, ...], str]' [invalid-annotation] + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type +File "specialtypes_tuple_unpack.py", line 39, in func1: Type annotation for t7 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[str, str] +File "specialtypes_tuple_unpack.py", line 40, in func1: Invalid type annotation 'tuple[*tuple[str, ...], str]' [invalid-annotation] + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type +File "specialtypes_tuple_unpack.py", line 40, in func1: Type annotation for t8 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[str, str] +File "specialtypes_tuple_unpack.py", line 41, in func1: Invalid type annotation 'tuple[*tuple[str, ...], str, str, str]' [invalid-annotation] + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type + Invalid type annotation '' + Not a type +File "specialtypes_tuple_unpack.py", line 41, in func1: Type annotation for t9 does not match type of assignment [annotation-type-mismatch] + Annotation: Tuple[Any] + Assignment: Tuple[str, str] +""" diff --git a/conformance/results/pytype/specialtypes_type.toml b/conformance/results/pytype/specialtypes_type.toml new file mode 100644 index 000000000..08e2faaa4 --- /dev/null +++ b/conformance/results/pytype/specialtypes_type.toml @@ -0,0 +1,32 @@ +conformant = "Partial" +notes = """ +Does not reject Callable when passed to type[T]. +Does not allow access to known attributes from object of type `type[Any]`. +""" +output = """ +File "specialtypes_type.py", line 56, in : Function func4 was called with the wrong arguments [wrong-arg-types] + Expected: (user_class: Type[Union[BasicUser, ProUser]]) + Actually passed: (user_class: Type[TeamUser]) +File "specialtypes_type.py", line 64, in : Invalid type annotation 'T' [invalid-annotation] + TypeVar 'T' appears only once in the function signature +File "specialtypes_type.py", line 76, in : Invalid type annotation 'type[int, str]' [invalid-annotation] + type[_T] expected 1 parameter, got 2 +File "specialtypes_type.py", line 98, in func7: Any [assert-type] + Expected: Tuple[type, ...] + Actual: Any +File "specialtypes_type.py", line 102, in func7: Any [assert-type] + Expected: Tuple[type, ...] + Actual: Any +File "specialtypes_type.py", line 106, in func7: Any [assert-type] + Expected: Tuple[type, ...] + Actual: Any +File "specialtypes_type.py", line 110, in func7: Any [assert-type] + Expected: Tuple[type, ...] + Actual: Any +File "specialtypes_type.py", line 117, in func8: No attribute 'unknown' on Type[object] [attribute-error] +File "specialtypes_type.py", line 120, in func8: No attribute 'unknown' on Type[object] [attribute-error] +File "specialtypes_type.py", line 143, in : No attribute 'unknown' on Type[type] [attribute-error] +File "specialtypes_type.py", line 144, in : No attribute 'unknown' on Type[type] [attribute-error] +File "specialtypes_type.py", line 145, in : No attribute 'unknown' on Type[type] [attribute-error] +File "specialtypes_type.py", line 146, in : No attribute 'unknown' on Type[type] [attribute-error] +""" diff --git a/conformance/results/pytype/version.toml b/conformance/results/pytype/version.toml index cdc708bb1..30f7c2a2f 100644 --- a/conformance/results/pytype/version.toml +++ b/conformance/results/pytype/version.toml @@ -1,2 +1,2 @@ version = "pytype 2023.12.18" -test_duration = 28.1415696144104 +test_duration = 26.710652112960815 diff --git a/conformance/results/results.html b/conformance/results/results.html index a3f2e4f93..2f4ca5a1d 100644 --- a/conformance/results/results.html +++ b/conformance/results/results.html @@ -127,15 +127,29 @@

Python Type System Conformance Test Results

-
mypy 1.8.0(0.40sec) +
mypy 1.8.0(0.66sec)
+ + + + + + + + + + + + + @@ -144,6 +158,17 @@

Python Type System Conformance Test Results

+ + + + + + + + + @@ -161,12 +186,30 @@

Python Type System Conformance Test Results

+ + + + + + + + + + + + + + + + @@ -184,7 +227,7 @@

Python Type System Conformance Test Results

- + @@ -197,16 +240,42 @@

Python Type System Conformance Test Results

Type narrowing + + + + + + + + + + +
Type annotations
     annotations_coroutinesPass
     annotations_forward_refsPartialDoes 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.
     annotations_generatorsPartialDoes not report incompatible Generator type in `yield from` statement.
     annotations_methodsPassType evaluation differs from other type checkers because of ambiguity in the spec related to method bindings.
     annotations_typeexprPass
+Special types in annotations
     specialtypes_anyPass
     specialtypes_neverPartialDoes not reject NoReturn when used outside of return type annotation.
     specialtypes_nonePass
     specialtypes_promotionsPass
     specialtypes_tuplePass
     specialtypes_tuple_unpackPass
     specialtypes_typePartialDoes not treat `type` same as `type[Any]` for assert_type.
Does not allow access to unknown attributes from object of type `type[Any]`.
Generics
     generics_self_advancedPartialDoes 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]`.
     generics_self_attributesPass
     generics_self_usagePass
+Type qualifiers
     qualifiers_annotatedPartialDoes not allow ClassVar to be nested within Annotated.
Does not allow Final to be nested within Annotated.
Does not allow Required and NotRequired to be nested within Annotated.
     qualifiers_final_annotationPartialDoes 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.
     qualifiers_final_decoratorPass
+Class type compatibility
     classes_classvarPartialInternal error if TypeVarTuple is used in ClassVar.
Does not reject use of ParamSpec in ClassVar.
Rejects ClassVar nested in Annotated.
Does not reject use of ClassVar in TypeAlias definition.
Does not infer type of ClassVar from assignment if no type is provided.
     classes_overridePartialDoes not handle case where parent class derives from Any.
Type aliases
     aliases_explicitPartialDoes not reject specialization of type alias that has already been implicitly specialized.
     aliases_implicitPass
     literals_semanticsPass
+Protocols
     protocols_class_objectsPass
     protocols_definitionPartialRejects implicit class variable when matching protocol with explicit ClassVar.
Does not detect protocol mismatch if concrete method is missing annotations.
Does not detect protocol mismatch if concrete method's parameters are position-only.
     protocols_explicitPassDoes not report unimplemented attributes for class that explicitly derives from protocol until it is instantiated.
     protocols_genericPartialFails protocol matching when method-scoped TypeVar is used in protocol.
     protocols_mergingPass
     protocols_modulesPass
     protocols_recursivePass
     protocols_runtime_checkablePartialDoes not report unsafe overlap for runtime_checkable protocol.
     protocols_selfPass
     protocols_subtypingPass
     protocols_variancePass
Callables
     callables_annotationPass
     callables_kwargsPass
     callables_protocolPass
+Overloads
     overloads_basicPass
Dataclasses
     dataclasses_descriptorsPartialDoes not correctly evaluate type of descriptor access.
     dataclasses_frozenPass
Typed dictionaries
     typeddicts_alt_syntaxPartialDoes not support keyword-argument form of alternative syntax (deprecated in 3.11).
     typeddicts_alt_syntaxPassDoes not support keyword-argument form of alternative syntax (deprecated in 3.11).
     typeddicts_class_syntaxPass
     typeddicts_finalPass
     typeddicts_inheritancePass
     narrowing_typeguardPass
+Type checker directives
     directives_assert_typePass
     directives_castPass
     directives_no_type_checkPass
     directives_reveal_typePass
     directives_type_checkingPass
     directives_type_ignorePartialDoes not honor "# type: ignore" comment if comment includes additional text.
     directives_type_ignore_file1Pass
     directives_type_ignore_file2Pass
     directives_version_platformPassDoes not understand three-element form of sys.version checks.
Does not understand os.name checks.
-
pyright 1.1.343(1.01sec) +
pyright 1.1.344(1.24sec)
+ + + + + + + + + + + + + @@ -215,13 +284,24 @@

Python Type System Conformance Test Results

+ + + + + + + + + - - - + + + - - + + + + + + + + + + + + + + + - + + + + @@ -245,7 +343,7 @@

Python Type System Conformance Test Results

- + @@ -268,16 +366,42 @@

Python Type System Conformance Test Results

Type narrowing + + + + + + + + + + +
Type annotations
     annotations_coroutinesPass
     annotations_forward_refsPass
     annotations_generatorsPass
     annotations_methodsPassType evaluation differs from other type checkers because of ambiguity in the spec related to method bindings.
     annotations_typeexprPass
+Special types in annotations
     specialtypes_anyPass
     specialtypes_neverPartialDoes not reject NoReturn when used outside of return type annotation.
     specialtypes_nonePass
     specialtypes_promotionsPass
     specialtypes_tuplePass
     specialtypes_tuple_unpackPass
     specialtypes_typePartialDoes not reject Callable when passed to type[T].
Generics
     generics_self_advancedPass
     generics_self_attributesPass
     generics_self_usagePass
+Type qualifiers
     qualifiers_annotatedPartialDoes not reject all invalid type expressions within Annotated.
     qualifiers_final_annotationPartialDoes not treat use of Final name as if it was replaced by the literal in NamedTuple definition.
     qualifiers_final_decoratorPartialDoes not report override of overloaded method marked @final.
Does not report error for non-method function marked @final.
Does not report error if overload is marked @final but implementation is not.
Does not report error in stub if first overload is not marked @final but subsequent ones are.
+Class type compatibility
     classes_classvarPass
     classes_overridePass
Type aliases
     aliases_explicitPartialIncorrectly evaluates type of specialized type alias parameterized with ParamSpec.
Allows some illegal annotation forms to be interpreted as valid type aliases.
     aliases_implicitPartialIncorrectly evaluates type of specialized type alias parameterized with ParamSpec.
Allows some illegal annotation forms to be interpreted as valid type aliases.
     aliases_newtypePartialDoes not reject use of NewType in `isinstance` call.
Does not report inconsistency between name of NewType and assigned identifier name.
Does not reject use of NewType with TypedDict class.
Does not reject use of NewType with another NewType.
Does not reject use of NewType with Any.
     aliases_explicitPass
     aliases_implicitPass
     aliases_newtypePass
     aliases_recursivePass
     aliases_type_statementPartialDoes not reject binary expression when used in type alias definition.
     aliases_typealiastypePartialDoes not reject type alias expression that uses TypeVar that is not in scope and not in `type_params`.
Does not allow access to `__value__` attribute of type alias.
Allows some illegal annotation forms to be interpreted as valid type aliases.
     aliases_type_statementPass
     aliases_typealiastypePass
     aliases_variancePass
@@ -232,10 +312,28 @@

Python Type System Conformance Test Results

     literals_semanticsPass
+Protocols
     protocols_class_objectsPartialIncorrectly reports some class objects as incompatible with a protocol.
Fails to report some class objects as incompatible with a protocol.
     protocols_definitionPartialDoes not reject ClassVar in concrete class when attribute in protocol is not ClassVar.
     protocols_explicitPartialDoes not report error when calling unimplemented protocol method from derived class.
     protocols_genericPass
     protocols_mergingPass
     protocols_modulesPass
     protocols_recursivePass
     protocols_runtime_checkablePartialDoes not reject issubclass call for data protocol.
Does not report unsafe overlap for runtime_checkable protocol.
     protocols_selfPass
     protocols_subtypingPass
     protocols_variancePartialDoes not exempt "self" and "cls" parameters from variance checks.
Callables
     callables_annotationPass
     callables_kwargsPass
     callables_protocolPartialDoes not report type incompatibility for callback protocol with positional-only parameters.
     callables_protocolPass
+Overloads
     overloads_basicPass
Dataclasses
     dataclasses_inheritancePass
     dataclasses_kwonlyPass
     dataclasses_orderPass
     dataclasses_postinitPartialReports incorrect error for incompatible `__post_init__` method override.
     dataclasses_postinitPass
     dataclasses_slotsPass
     dataclasses_transform_classPass
     dataclasses_transform_fieldPass
     narrowing_typeguardPass
+Type checker directives
     directives_assert_typePass
     directives_castPass
     directives_no_type_checkUnsupportedIntentionally does not honor @no_type_check decorator.
     directives_reveal_typePass
     directives_type_checkingPass
     directives_type_ignorePass
     directives_type_ignore_file1Pass
     directives_type_ignore_file2Pass
     directives_version_platformPass
-
pyre 0.9.19(1.40sec) +
pyre 0.9.19(2.12sec)
+ + + + + + + + + + + + + @@ -286,6 +410,17 @@

Python Type System Conformance Test Results

+ + + + + + + + + @@ -303,12 +438,30 @@

Python Type System Conformance Test Results

+ + + + + + + + + + + + + + + + @@ -339,14 +492,40 @@

Python Type System Conformance Test Results

Type narrowing + + + + + + + + + + +
Type annotations
     annotations_coroutinesPartialDoes not evaluate correct type for async function.
     annotations_forward_refsPartialDoes 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).
Does not reject f-string in quoted type annotation.
Incorrectly generates error for quoted type defined in class scope.
Does not generate error for unquoted type defined in class scope.
     annotations_generatorsPartialDoes not report invalid return type for generator when function implicitly returns None.
Incorrectly evaluates type of call to async generator.
     annotations_methodsPassType evaluation differs from other type checkers because of ambiguity in the spec related to method bindings.
     annotations_typeexprPass
+Special types in annotations
     specialtypes_anyPartialDoes not treat missing type argument as Any in generic type.
Does not support Any as a base class.
     specialtypes_neverPartialDoes not reject NoReturn when used outside of return type annotation.
Does not treat Never as compatible with all other types.
     specialtypes_nonePartialDoes not correctly handle type annotation type[None].
     specialtypes_promotionsPartialDoes not reject use of attribute that is compatible only with float.
     specialtypes_tuplePartialDoes not report type violation when assigning tuple[T, ...] to tuple[T].
     specialtypes_tuple_unpackUnsupportedDoes not support unpacked tuple in type expression.
     specialtypes_typePartialDoes not reject Callable when passed to type[T].
Does not treat `type` same as `type[Any]` for assert_type.
Does not allow access to unknown attributes from object of type `type[Any]`.
Does not reject access to unknown attributes from object of type `Type[object]`.
Reports type incompatibility between `type` and `Callable[..., Any]`.
Generics
     generics_self_advancedUnsupportedDoes not understand `Self` type.
     generics_self_attributesUnsupportedDoes not understand `Self` type.
     generics_self_usageUnsupportedDoes not understand `Self` type.
+Type qualifiers
     qualifiers_annotatedPartialDoes not reject Annotated with a single parameter.
     qualifiers_final_annotationPartialDoes not report Final variable with missing initialization in module scope.
Does not report error for invalid nesting of Final and ClassVar.
Does not treat use of Final name as if it was replaced by the literal in NamedTuple definition.
     qualifiers_final_decoratorPartialReports error for overloaded method implementation marked @final if its overloads do not.
Does not report error for overloaded @final method defined in stub file.
Reports misleading error when overload is marked @final but implementation is not.
+Class type compatibility
     classes_classvarPartialDoes not reject use of TypeVar in ClassVar.
Does not reject use of ParamSpec in ClassVar.
Does not reject use of ClassVar as a generic type argument.
Does not reject use of ClassVar in parameter type annotation.
Does not reject use of ClassVar in local variable annotation.
Does not reject use of ClassVar in instance variable annotation.
Does not reject use of ClassVar in return type annotation.
Does not reject use of ClassVar in type alias definition.
     classes_overrideUnsupportedDoes not yet support the @override decorator.
Type aliases
     aliases_explicitPartialIncorrectly reports error for type alias defined with ParamSpec.
Incorrectly rejects some valid type aliases when used in annotations.
Incorrectly evaluates generic type alias with ParamSpec with missing type argument.
Does not report some illegal annotation forms as invalid type aliases.
Does not report invalid specialization of generic type aliases.
Incorrectly rejects import alias of `TypeAlias` when used to define type alias.
Does not report invalid specialization of already-specialized generic type alias.
     aliases_implicitPartialIncorrectly reports error for type alias defined with ParamSpec.
Incorrectly rejects some valid type aliases when used in annotations.
Incorrectly evaluates generic type alias with ParamSpec with missing type argument.
Does not report invalid specialization of generic type aliases.
Does not report error for attempt to instantiate union type alias.
Does not report invalid specialization of already-specialized generic type alias.
     literals_semanticsPartialDoes not reject augmented operation that modifies literal value.
+Protocols
     protocols_class_objectsPartialDoes not reject protocol class assigned to type[Proto].
Incorrectly reports some class objects as incompatible with a protocol.
Fails to report some class objects as incompatible with a protocol.
     protocols_definitionPartialDoes not reject ClassVar in concrete class when attribute in protocol is not ClassVar.
Does not reject read-only property in concrete class when attribute in protocol is mutable.
Does not reject covariant attribute type when protocol attribute is mutable.
Does not reject read-only property in concrete class when protocol has settable property.
Does not reject immutable named tuple attribute in concrete class when protocol attribute is mutable.
Does not reject immutable frozen dataclass attribute in concrete class when protocol attribute is mutable.
     protocols_explicitPartialDoes not report error when calling unimplemented protocol method from derived class.
Does not report error when method is not implemented in derived class.
     protocols_genericPartialDoes not reject the use of Protocol and Generic together as base classes.
Does not detect protocol mismatch when method-scoped TypeVar is used in protocol.
     protocols_mergingPartialDoes not reject a protocol class that derives from a non-protocol class.
     protocols_modulesUnsupportedDoes not perform protocol checks for modules.
     protocols_recursivePass
     protocols_runtime_checkableUnsupportedDoes not reject isinstance or issubclass call for protocol that is not runtime_checkable.
Does not reject issubclass call for data protocol.
Does not report unsafe overlap for runtime_checkable protocol.
     protocols_selfPass
     protocols_subtypingPass
     protocols_varianceUnsupportedDoes not detect incorrect TypeVar variance within generic protocols.
Callables
     callables_annotationPartialDoes not evaluate correct type for `*args: int` parameter.
Does not reject illegal form `Callable[[...], int]`.
     callables_kwargsUnsupportedDoes not understand Unpack in the context of **kwargs annotation.
     callables_protocolPartialDoes not correctly handle callback protocol that declares attributes in all functions.
Does not report type incompatibility for callback protocol with positional-only parameters.
Incorrectly reports type compatibility error with callback that has *args and **kwargs.
Does not report type incompatibility for callback missing a default argument for positional parameter.
Does not report type incompatibility for callback missing a default argument for keyword parameter.
+Overloads
     overloads_basicPartialDoes not reject a function with a single @overload signature.
Dataclasses
     dataclasses_descriptorsPartialIncorrectly generates error when calling constructor of dataclass with descriptor.
     dataclasses_frozenPartialDoes not reject frozen dataclass inherited from non-frozen dataclass.
Does not reject non-frozen dataclass inherited from frozen dataclass.
     narrowing_typeguardPartialDoes not support `tuple` in `assert_type` call.
Does not reject TypeGuard method with too few parameters.
+Type checker directives
     directives_assert_typeUnsupportedDoes not understand "assert_type".
     directives_castPass
     directives_no_type_checkUnsupportedDoes not honor @no_type_check decorator.
     directives_reveal_typeUnsupportedDoes not understand reveal_type call.
     directives_type_checkingPass
     directives_type_ignorePass
     directives_type_ignore_file1UnsupportedDoes not support file-level `#type: ignore` comment.
     directives_type_ignore_file2Pass
     directives_version_platformPartialDoes not support sys.platform checks.
Does not support os.name checks.
-
pytype 2023.12.18(28.14sec) +
pytype 2023.12.18(26.71sec)
- + + + + + + + + + + + + + + @@ -357,6 +536,17 @@

Python Type System Conformance Test Results

+ + + + + + + + + @@ -374,12 +564,30 @@

Python Type System Conformance Test Results

+ + + + + + + + + + + + + + + + @@ -410,6 +618,18 @@

Python Type System Conformance Test Results

Type narrowing + + + + + + + + + + +
Type annotations
     annotations_typeexprPartialDoes not reject call expressions in type annotation.
Does not reject call lambda expression in type annotation.
Does not reject list expression in type annotation.
Does not reject ternary expression in type annotation.
Does not reject f-string in type annotation.
     annotations_coroutinesPartialDoes not evaluate correct type for async function.
     annotations_forward_refsPartialDoes not reject some illegal type expression forms when quoted.
Incorrectly generates error for quoted type defined in class scope.
Evaluates incorrect type for class variable annotated with quoted type expression.
     annotations_generatorsPartialDoes not report invalid return type for generator when function implicitly returns None.
Reports invalid error when return type of generator is annotated as a compatible protocol.
Does not report type violation in `yield from` statement.
     annotations_methodsPassType evaluation differs from other type checkers because of ambiguity in the spec related to method bindings.
     annotations_typeexprPartialDoes not reject call expressions in type annotation.
Does not reject call lambda expression in type annotation.
Does not reject list expression in type annotation.
Does not reject ternary expression in type annotation.
Does not reject f-string in type annotation.
Does not reject module in type annotation.
+Special types in annotations
     specialtypes_anyPass
     specialtypes_neverUnsupportedDoes not understand NoReturn or Never.
     specialtypes_nonePartialDoes not detect type incompatibility between None and type[None].
Does not detect type incompatibility between None and incompatible protocol.
     specialtypes_promotionsPass
     specialtypes_tuplePartialDoes not report type violation when assigning tuple[T, ...] to tuple[T].
     specialtypes_tuple_unpackUnsupportedDoes not support unpacked tuple in type expression.
     specialtypes_typePartialDoes not reject Callable when passed to type[T].
Does not allow access to known attributes from object of type `type[Any]`.
Generics
     generics_self_usageUnsupportedDoes not understand `Self` type.
+Type qualifiers
     qualifiers_annotatedPartialDoes not reject some illegal type expression forms used in Annotated.
Does not allow TypeVar to be used in type alias when wrapped with Annotated.
     qualifiers_final_annotationPartialDoes not report Final variable with missing initialization.
Does not reject Final instance variable declared outside of __init__ method.
Does not reject modification of global variable declared Final.
Does not reject modification of local variable declared Final.
     qualifiers_final_decoratorPartialDoes not report error for overloaded @final method defined in stub file.
Does not report error for overload that is marked @final when implementation is not.
+Class type compatibility
     classes_classvarPartialDoes not reject use of TypeVar in ClassVar.
Does not reject use of ParamSpec in ClassVar.
Does not reject use of ClassVar as a generic type argument.
Rejects initialization of ClassVar if no type argument is provided.
Does not reject use of ClassVar in parameter type annotation.
Does not reject use of ClassVar in local variable annotation.
Does not reject use of ClassVar in instance variable annotation.
Does not reject use of ClassVar in return type annotation.
Does not reject use of ClassVar in type alias definition.
Does not reject assignment of ClassVar through instance of class.
     classes_overrideUnsupportedDoes not yet support the @override decorator.
Type aliases
     aliases_explicitPartialIncorrectly reports error for type alias defined with ParamSpec.
Does not report invalid specialization of generic type alias with bound TypeVar.
Incorrectly evaluates generic type alias with ParamSpec with missing type argument.
Does not report some illegal annotation forms as invalid type aliases.
Does not report invalid specialization of already-specialized generic type alias.
     aliases_implicitPartialIncorrectly reports error for type alias defined with ParamSpec.
Does not report invalid specialization of generic type alias with bound TypeVar.
Incorrectly evaluates generic type alias with ParamSpec with missing type argument.
Allows some illegal annotation forms to be interpreted as valid type aliases.
Does not report invalid specialization of already-specialized generic type alias.
     literals_semanticsUnsupportedDoes not understand `Literal` type annotation.
+Protocols
     protocols_class_objectsPartialDoes not reject protocol class assigned to type[Proto].
Incorrectly reports some class objects as incompatible with a protocol.
Fails to report some class objects as incompatible with a protocol.
     protocols_definitionPartialReports errors for protocol static method with "..." implementation.
Does not report error when instance variable is set through "self" access in protocol class.
Does not report protocol mismatch when concrete class has attribute with covariant type and protocol attribute is mutable.
Does not reject ClassVar in concrete class when attribute in protocol is not ClassVar.
Does not reject read-only property in concrete class when attribute in protocol is mutable.
Does not reject covariant attribute type when protocol attribute is mutable.
Does not detect protocol mismatch if concrete method is missing annotations.
Does not detect protocol mismatch if concrete method's parameters are keyword-only.
Does not detect protocol mismatch if concrete method's parameters are position-only.
Does not detect protocol mismatch if concrete method is a classmethod.
Does not detect protocol mismatch if concrete method is a staticmethod.
Does not reject read-only property in concrete class when protocol has settable property.
Does not reject immutable named tuple attribute in concrete class when protocol attribute is mutable.
Does not reject immutable frozen dataclass attribute in concrete class when protocol attribute is mutable.
     protocols_explicitPartialReports errors for protocol static method with "..." implementation.
Does not report error when calling unimplemented protocol method from derived class.
Does not report type incompatibility when assigning to attribute defined in protocol.
Does not reject instantiation of class that derives from protocol but doesn't implement attribute.
Does not report instantiation of class that derives from protocol but doesn't implement method.
     protocols_genericPartialDoes not correctly enforce contravariance in protocol type compatibility tests.
Does not correctly enforce invariance in protocol type compatibility tests.
Does not detect protocol mismatch when method-scoped TypeVar is used in protocol.
     protocols_mergingPartialDoes not reject a protocol class that derives from a non-protocol class.
Does not report attempt to instantiate abstract class downgraded from protocol class.
     protocols_modulesPartialDoes not report incompatibilities for protocol methods.
     protocols_recursivePartialIncorrectly reports type error for some recursive protocols.
     protocols_runtime_checkableUnsupportedDoes not reject isinstance or issubclass call for protocol that is not runtime_checkable.
Does not reject issubclass call for data protocol.
Does not report unsafe overlap for runtime_checkable protocol.
     protocols_selfPartialDoes not properly handle Self type within a protocol.
     protocols_subtypingPartialDoes not reject attempt to instantiate protocol class.
Does not report some protocol type compatibility violations involving contravariance.
     protocols_varianceUnsupportedDoes not detect incorrect TypeVar variance within generic protocols.
Callables
     callables_annotationPass
     callables_kwargsUnsupportedDoes not understand Unpack in the context of **kwargs annotation.
     callables_protocolUnsupportedDoes not properly handle type compatibility checks with callback protocols.
+Overloads
     overloads_basicPartialDoes not reject a function with a single @overload signature.
Does not reject a function with @overload signature but no implementation.
Dataclasses
     dataclasses_descriptorsUnsupportedDoes not understand descriptor objects in dataclass.
     dataclasses_frozenUnsupportedDoes not report assignment to field within frozen dataclass instance.
Does not reject frozen dataclass inherited from non-frozen dataclass.
Does not reject non-frozen dataclass inherited from frozen dataclass.
     narrowing_typeguardPartialDoes not reject TypeGuard method with too few parameters.
+Type checker directives
     directives_assert_typePass
     directives_castPartialDoes not reject a call to "cast" with additional arguments.
     directives_no_type_checkUnsupportedDoes not honor @no_type_check decorator.
     directives_reveal_typePartialDoes not reject call to reveal_type with zero arguments.
Does not reject call to reveal_type with too many arguments.
     directives_type_checkingPass
     directives_type_ignorePartialDoes not honor "# type: ignore" comment if comment includes additional text.
     directives_type_ignore_file1Pass
     directives_type_ignore_file2PartialDoes not ignore `# type: ignore` if it occurs after docstrings in the file.
     directives_version_platformPassDoes not understand three-element form of sys.version checks.
Does not understand os.name checks.