ruff/crates/red_knot_python_semantic/resources/mdtest
Dhruv Manilawala 113c804a62
[red-knot] Add support for unpacking for target (#15058)
## Summary

Related to #13773 

This PR adds support for unpacking `for` statement targets.

This involves updating the `value` field in the `Unpack` target to use
an enum which specifies the "where did the value expression came from?".
This is because for an iterable expression, we need to unpack the
iterator type while for assignment statement we need to unpack the value
type itself. And, this needs to be done in the unpack query.

### Question

One of the ways unpacking works in `for` statement is by looking at the
union of the types because if the iterable expression is a tuple then
the iterator type will be union of all the types in the tuple. This
means that the test cases that will test the unpacking in `for`
statement will also implicitly test the unpacking union logic. I was
wondering if it makes sense to merge these cases and only add the ones
that are specific to the union unpacking or for statement unpacking
logic.

## Test Plan

Add test cases involving iterating over a tuple type. I've intentionally
left out certain cases for now and I'm curious to know any thoughts on
the above query.
2024-12-23 06:13:49 +00:00
..
annotations [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
assignment [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
binary Improve mdtests style (#14884) 2024-12-10 13:05:51 +00:00
boolean [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
call [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
comparison [red-knot] More precise inference for chained boolean expressions (#15089) 2024-12-22 10:02:28 -08:00
conditional [red-knot] Improve match mdtests (#14951) 2024-12-13 09:50:17 +01:00
declaration [red-knot] Avoid undeclared path when raising conflicting declarations (#14958) 2024-12-17 09:49:39 +05:30
exception [red-knot] Report invalid exceptions (#15042) 2024-12-18 18:31:24 +00:00
expression [red-knot] More precise inference for chained boolean expressions (#15089) 2024-12-22 10:02:28 -08:00
function [red-knot] function parameter types (#14802) 2024-12-06 12:55:56 -08:00
import Prioritize attribute in from/import statement (#15041) 2024-12-17 16:58:23 -05:00
literal [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
loops [red-knot] Tests for 'while' loop boundness (#14944) 2024-12-12 21:06:56 +01:00
narrow [red-knot] Treat classes as instances of their respective metaclasses in boolean tests (#15105) 2024-12-23 01:30:51 +00:00
regression [red-knot] Do not attach diagnostics to wrong file (#14337) 2024-11-14 15:39:51 +01:00
scopes Sync vendored typeshed stubs (#14977) 2024-12-15 01:02:41 +00:00
shadowing Improve mdtests style (#14884) 2024-12-10 13:05:51 +00:00
stubs Fix typos found by codespell (#14863) 2024-12-09 09:32:12 +00:00
subscript [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
suppressions Basic support for type: ignore comments (#15046) 2024-12-20 10:35:09 +01:00
type_of Bind top-most parent when importing nested module (#14946) 2024-12-16 16:15:40 -05:00
unary Don't special-case class instances in unary expression inference (#15045) 2024-12-18 14:37:17 -05:00
with [red-knot] Cleanup various todo_type!() messages (#15063) 2024-12-19 13:03:41 +00: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] Reduce TODOs in Type::member() (#15066) 2024-12-19 15:54:01 +00:00
final.md [red-knot] Add support for @final classes (#15070) 2024-12-19 21:02:14 +00:00
generics.md [red-knot] Add infrastructure to declare lints (#14873) 2024-12-10 16:14:44 +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] Support typing.TYPE_CHECKING (#14952) 2024-12-13 09:24:48 +00:00
mdtest_config.md Rename custom-typeshed-dir, target-version and current-directory CLI options (#14930) 2024-12-13 08:21:52 +00:00
metaclass.md [red-knot] Use type[Unknown] rather than Unknown as the fallback metaclass for invalid classes (#14961) 2024-12-13 19:48:51 +00:00
mro.md [red-knot] Add infrastructure to declare lints (#14873) 2024-12-10 16:14:44 +00:00
pep695_type_aliases.md [red-knot] mdtest: python version requirements (#14954) 2024-12-13 10:40:38 +01:00
statically_known_branches.md [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
sys_platform.md [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
sys_version_info.md Rename custom-typeshed-dir, target-version and current-directory CLI options (#14930) 2024-12-13 08:21:52 +00:00
unpacking.md [red-knot] Add support for unpacking for target (#15058) 2024-12-23 06:13:49 +00:00