ruff/crates/red_knot_python_semantic/resources/mdtest
Carl Meyer 87d011e1bd
[red-knot] fix non-callable reporting for unions (#16387)
Minor follow-up to https://github.com/astral-sh/ruff/pull/16161

This `not_callable` flag wasn't functional, because it could never be
`false`. It was initialized to `true` and then only ever updated with
`|=`, which can never make it `false`.

Add a test that exercises the case where it _should_ be `false` (all of
the union elements are callable) but `bindings` is also empty (all union
elements have binding errors). Before this PR, the added test wrongly
emits a diagnostic that the union `Literal[f1] | Literal[f2]` is not
callable.

And add a test where a union call results in one binding error and one
not-callable error, where we currently give the wrong result (we show
only the binding error), with a TODO.

Also add TODO comments in a couple other tests where ideally we'd report
more than just one error out of a union call.

Also update the flag name to `all_errors_not_callable` to more clearly
indicate the semantics of the flag.
2025-02-26 07:06:04 -08:00
..
annotations [red-knot] Add diagnostic for class-object access to pure instance variables (#16036) 2025-02-24 15:17:16 +01:00
assignment Refactor CallOutcome to Result (#16161) 2025-02-18 13:34:39 +01:00
binary [red-knot] Correct modeling of dunder calls (#16368) 2025-02-25 20:38:15 +01:00
boolean [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
boundness_declaredness [red-knot] Enforce specifying paths for mdtest code blocks in a separate preceding line (#15890) 2025-02-04 08:27:17 +01:00
call [red-knot] fix non-callable reporting for unions (#16387) 2025-02-26 07:06:04 -08:00
comparison [red-knot] Correct modeling of dunder calls (#16368) 2025-02-25 20:38:15 +01:00
comprehensions [red-knot] Resolve references in eager nested scopes eagerly (#16079) 2025-02-19 10:22:30 -05:00
conditional [red-knot] Diagnostics for incorrect bool usages (#16238) 2025-02-21 19:26:05 +01:00
declaration [red-knot] Avoid undeclared path when raising conflicting declarations (#14958) 2024-12-17 09:49:39 +05:30
diagnostics [red-knot] Better diagnostics for method calls (#16362) 2025-02-25 09:58:08 +01:00
directives [red-knot] Add missing imports in mdtests (#15869) 2025-02-03 09:27:29 +00:00
doc [red-knot] Document 'public type of undeclared symbols' behavior (#16096) 2025-02-12 08:52:11 +01:00
exception [red-knot] MDTest: Use custom class names instead of builtins (#16269) 2025-02-20 12:25:55 +00:00
expression [red-knot] Add diagnostic for class-object access to pure instance variables (#16036) 2025-02-24 15:17:16 +01:00
function [red-knot] function parameter types (#14802) 2024-12-06 12:55:56 -08:00
import [red-knot] Support re-export conventions for stub files (#16073) 2025-02-14 15:17:51 +05:30
literal [red-knot] Migrate bool/str/repr unit tests to Markdown tests (#15534) 2025-01-16 11:21:56 -08:00
loops [red-knot] Correct modeling of dunder calls (#16368) 2025-02-25 20:38:15 +01:00
narrow Teach red-knot that type(x) is the same as x.__class__ (#16301) 2025-02-21 21:05:48 +00:00
regression [red-knot] Enforce specifying paths for mdtest code blocks in a separate preceding line (#15890) 2025-02-04 08:27:17 +01:00
scopes [red-knot] Add diagnostic for class-object access to pure instance variables (#16036) 2025-02-24 15:17:16 +01:00
shadowing [red-knot] Merge Markdown code blocks inside a single section (#15950) 2025-02-05 22:26:15 +01:00
snapshots [red-knot] Correct modeling of dunder calls (#16368) 2025-02-25 20:38:15 +01:00
stubs [red-knot] Enforce specifying paths for mdtest code blocks in a separate preceding line (#15890) 2025-02-04 08:27:17 +01:00
subscript [red-knot] Add support for @classmethods (#16305) 2025-02-24 09:55:34 +01:00
suppressions [red-knot] Merge Markdown code blocks inside a single section (#15950) 2025-02-05 22:26:15 +01:00
type_of [red-knot] Method calls and the descriptor protocol (#16121) 2025-02-20 23:22:26 +01:00
type_properties [red-knot] Generalise special-casing for KnownClasses in Type::bool (#16300) 2025-02-21 20:46:36 +00:00
type_qualifiers [red-knot] Handle possibly-unbound instance members (#16363) 2025-02-25 20:00:38 +01:00
unary [red-knot] Diagnostics for incorrect bool usages (#16238) 2025-02-21 19:26:05 +01:00
with Refactor CallOutcome to Result (#16161) 2025-02-18 13:34:39 +01:00
.mdformat.toml [red-knot] have mdformat wrap mdtest files to 100 columns (#14020) 2024-10-31 21:00:51 +00:00
attributes.md [red-knot] Handle possibly-unbound instance members (#16363) 2025-02-25 20:00:38 +01:00
descriptor_protocol.md [red-knot] Better diagnostics for method calls (#16362) 2025-02-25 09:58:08 +01:00
final.md [red-knot] Add support for @final classes (#15070) 2024-12-19 21:02:14 +00:00
generics.md [red-knot] Enforce specifying paths for mdtest code blocks in a separate preceding line (#15890) 2025-02-04 08:27:17 +01:00
intersection_types.md [red-knot] Add missing imports in mdtests (#15869) 2025-02-03 09:27:29 +00:00
invalid_syntax.md [red-knot] Separate invalid syntax code snippets (#14803) 2024-12-06 02:41:33 +00:00
known_constants.md [red-knot] Enforce specifying paths for mdtest code blocks in a separate preceding line (#15890) 2025-02-04 08:27:17 +01:00
mdtest_config.md [red-knot] Add missing imports in mdtests (#15869) 2025-02-03 09:27:29 +00:00
mdtest_custom_typeshed.md [red-knot] Enforce specifying paths for mdtest code blocks in a separate preceding line (#15890) 2025-02-04 08:27:17 +01:00
metaclass.md [red-knot] Enforce specifying paths for mdtest code blocks in a separate preceding line (#15890) 2025-02-04 08:27:17 +01:00
mro.md [red-knot] Enforce specifying paths for mdtest code blocks in a separate preceding line (#15890) 2025-02-04 08:27:17 +01:00
pep695_type_aliases.md [red-knot] Move type_alias_types test to Markdown (#15607) 2025-01-20 09:55:54 +01:00
protocols.md [red-knot] Method calls and the descriptor protocol (#16121) 2025-02-20 23:22:26 +01:00
slots.md [red-knot] Add support for @classmethods (#16305) 2025-02-24 09:55:34 +01:00
statically_known_branches.md [red-knot] Litate tests: minor follow-up (#15987) 2025-02-06 07:15:26 +00:00
sys_platform.md [red-knot] Method calls and the descriptor protocol (#16121) 2025-02-20 23:22:26 +01:00
sys_version_info.md [red-knot] Merge Markdown code blocks inside a single section (#15950) 2025-02-05 22:26:15 +01:00
terminal_statements.md [red-knot] Combine terminal statement support with statically known branches (#15817) 2025-02-05 17:47:49 -05:00
type_api.md [red-knot] Diagnostics for incorrect bool usages (#16238) 2025-02-21 19:26:05 +01:00
union_types.md [red-knot] add special case for float/complex (#16166) 2025-02-14 12:24:10 -08:00
unpacking.md [red-knot] Add missing imports in mdtests (#15869) 2025-02-03 09:27:29 +00:00