Commit 68b0386
[ty] Implement
Fixes: astral-sh/ty#92
## Summary
We currently get a `invalid-argument-type` error when using
`dataclass.fields` on a dataclass, because we do not synthesize the
`__dataclass_fields__` member.
This PR fixes this diagnostic.
Note that we do not yet model the `Field` type correctly. After that is
done, we can assign a more precise `tuple[Field, ...]` type to this new
member.
## Test Plan
New mdtest.
---------
Co-authored-by: David Peter <mail@david-peter.de>DataClassInstance protocol for dataclasses. (#18018)1 parent 0ae07cd commit 68b0386
File tree
3 files changed
+47
-5
lines changed- crates/ty_python_semantic
- resources/mdtest
- src
- types
3 files changed
+47
-5
lines changedLines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
616 | 616 | | |
617 | 617 | | |
618 | 618 | | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
619 | 638 | | |
620 | 639 | | |
621 | 640 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2939 | 2939 | | |
2940 | 2940 | | |
2941 | 2941 | | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
| 2948 | + | |
| 2949 | + | |
| 2950 | + | |
| 2951 | + | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
2942 | 2955 | | |
2943 | 2956 | | |
2944 | 2957 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1958 | 1958 | | |
1959 | 1959 | | |
1960 | 1960 | | |
| 1961 | + | |
| 1962 | + | |
1961 | 1963 | | |
1962 | 1964 | | |
1963 | 1965 | | |
| |||
2037 | 2039 | | |
2038 | 2040 | | |
2039 | 2041 | | |
2040 | | - | |
| 2042 | + | |
| 2043 | + | |
2041 | 2044 | | |
2042 | 2045 | | |
2043 | 2046 | | |
| |||
2108 | 2111 | | |
2109 | 2112 | | |
2110 | 2113 | | |
2111 | | - | |
| 2114 | + | |
| 2115 | + | |
2112 | 2116 | | |
2113 | 2117 | | |
2114 | 2118 | | |
| |||
2181 | 2185 | | |
2182 | 2186 | | |
2183 | 2187 | | |
| 2188 | + | |
2184 | 2189 | | |
2185 | 2190 | | |
2186 | 2191 | | |
| |||
2405 | 2410 | | |
2406 | 2411 | | |
2407 | 2412 | | |
| 2413 | + | |
2408 | 2414 | | |
2409 | 2415 | | |
2410 | 2416 | | |
| |||
2464 | 2470 | | |
2465 | 2471 | | |
2466 | 2472 | | |
2467 | | - | |
| 2473 | + | |
| 2474 | + | |
2468 | 2475 | | |
2469 | 2476 | | |
2470 | 2477 | | |
| |||
2526 | 2533 | | |
2527 | 2534 | | |
2528 | 2535 | | |
2529 | | - | |
| 2536 | + | |
| 2537 | + | |
2530 | 2538 | | |
2531 | 2539 | | |
2532 | 2540 | | |
| |||
2596 | 2604 | | |
2597 | 2605 | | |
2598 | 2606 | | |
| 2607 | + | |
2599 | 2608 | | |
2600 | 2609 | | |
2601 | 2610 | | |
| |||
2647 | 2656 | | |
2648 | 2657 | | |
2649 | 2658 | | |
2650 | | - | |
| 2659 | + | |
| 2660 | + | |
2651 | 2661 | | |
2652 | 2662 | | |
2653 | 2663 | | |
| |||
0 commit comments