Commit 39b4183
[ty] synthesize __setattr__ for frozen dataclasses (#19307)
## Summary
Synthesize a `__setattr__` method with a return type of `Never` for
frozen dataclasses.
https://docs.python.org/3/library/dataclasses.html#frozen-instances
https://docs.python.org/3/library/dataclasses.html#dataclasses.FrozenInstanceError
### Related
astral-sh/ty#111
#17974 (comment)
#18347 (comment)
## Test Plan
New Markdown tests
---------
Co-authored-by: David Peter <mail@david-peter.de>1 parent c7640a4 commit 39b4183
File tree
4 files changed
+144
-107
lines changed- crates/ty_python_semantic
- resources/mdtest
- dataclasses
- src/types
4 files changed
+144
-107
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1806 | 1806 | | |
1807 | 1807 | | |
1808 | 1808 | | |
1809 | | - | |
| 1809 | + | |
1810 | 1810 | | |
1811 | 1811 | | |
1812 | 1812 | | |
| |||
Lines changed: 34 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
418 | | - | |
419 | | - | |
| 418 | + | |
420 | 419 | | |
421 | 420 | | |
422 | 421 | | |
| |||
425 | 424 | | |
426 | 425 | | |
427 | 426 | | |
428 | | - | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
429 | 460 | | |
430 | 461 | | |
431 | 462 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1600 | 1600 | | |
1601 | 1601 | | |
1602 | 1602 | | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
1603 | 1622 | | |
1604 | 1623 | | |
1605 | 1624 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3446 | 3446 | | |
3447 | 3447 | | |
3448 | 3448 | | |
3449 | | - | |
3450 | | - | |
3451 | | - | |
3452 | | - | |
3453 | | - | |
3454 | | - | |
3455 | | - | |
3456 | | - | |
3457 | | - | |
3458 | | - | |
3459 | | - | |
3460 | | - | |
3461 | | - | |
3462 | | - | |
3463 | 3449 | | |
3464 | 3450 | | |
3465 | 3451 | | |
| |||
3476 | 3462 | | |
3477 | 3463 | | |
3478 | 3464 | | |
3479 | | - | |
3480 | | - | |
3481 | | - | |
3482 | | - | |
3483 | | - | |
| 3465 | + | |
| 3466 | + | |
| 3467 | + | |
| 3468 | + | |
| 3469 | + | |
| 3470 | + | |
| 3471 | + | |
| 3472 | + | |
| 3473 | + | |
| 3474 | + | |
| 3475 | + | |
| 3476 | + | |
| 3477 | + | |
| 3478 | + | |
| 3479 | + | |
| 3480 | + | |
| 3481 | + | |
| 3482 | + | |
| 3483 | + | |
| 3484 | + | |
| 3485 | + | |
| 3486 | + | |
| 3487 | + | |
| 3488 | + | |
| 3489 | + | |
| 3490 | + | |
| 3491 | + | |
| 3492 | + | |
| 3493 | + | |
| 3494 | + | |
| 3495 | + | |
| 3496 | + | |
| 3497 | + | |
| 3498 | + | |
| 3499 | + | |
3484 | 3500 | | |
3485 | 3501 | | |
3486 | 3502 | | |
| |||
3530 | 3546 | | |
3531 | 3547 | | |
3532 | 3548 | | |
3533 | | - | |
3534 | | - | |
3535 | | - | |
3536 | | - | |
3537 | | - | |
3538 | | - | |
3539 | | - | |
3540 | | - | |
3541 | | - | |
3542 | | - | |
3543 | | - | |
3544 | | - | |
3545 | | - | |
3546 | | - | |
3547 | | - | |
3548 | | - | |
3549 | | - | |
3550 | | - | |
3551 | | - | |
3552 | | - | |
3553 | | - | |
3554 | | - | |
3555 | | - | |
3556 | | - | |
3557 | | - | |
3558 | | - | |
3559 | | - | |
3560 | | - | |
3561 | | - | |
3562 | | - | |
3563 | | - | |
3564 | | - | |
3565 | | - | |
3566 | | - | |
3567 | | - | |
| 3549 | + | |
| 3550 | + | |
| 3551 | + | |
| 3552 | + | |
| 3553 | + | |
| 3554 | + | |
| 3555 | + | |
| 3556 | + | |
| 3557 | + | |
| 3558 | + | |
| 3559 | + | |
| 3560 | + | |
| 3561 | + | |
| 3562 | + | |
| 3563 | + | |
| 3564 | + | |
| 3565 | + | |
| 3566 | + | |
| 3567 | + | |
| 3568 | + | |
| 3569 | + | |
| 3570 | + | |
3568 | 3571 | | |
3569 | 3572 | | |
3570 | 3573 | | |
3571 | 3574 | | |
3572 | | - | |
3573 | 3575 | | |
| 3576 | + | |
3574 | 3577 | | |
3575 | | - | |
| 3578 | + | |
| 3579 | + | |
| 3580 | + | |
| 3581 | + | |
| 3582 | + | |
| 3583 | + | |
| 3584 | + | |
| 3585 | + | |
| 3586 | + | |
| 3587 | + | |
| 3588 | + | |
| 3589 | + | |
| 3590 | + | |
| 3591 | + | |
| 3592 | + | |
| 3593 | + | |
| 3594 | + | |
3576 | 3595 | | |
3577 | | - | |
| 3596 | + | |
3578 | 3597 | | |
3579 | 3598 | | |
3580 | | - | |
3581 | | - | |
3582 | | - | |
3583 | | - | |
3584 | | - | |
3585 | | - | |
3586 | | - | |
3587 | | - | |
3588 | | - | |
3589 | | - | |
3590 | | - | |
3591 | | - | |
3592 | | - | |
3593 | | - | |
3594 | | - | |
3595 | | - | |
3596 | | - | |
3597 | | - | |
3598 | | - | |
3599 | | - | |
3600 | | - | |
3601 | | - | |
3602 | | - | |
3603 | | - | |
| 3599 | + | |
| 3600 | + | |
| 3601 | + | |
| 3602 | + | |
| 3603 | + | |
| 3604 | + | |
| 3605 | + | |
| 3606 | + | |
3604 | 3607 | | |
3605 | | - | |
3606 | | - | |
3607 | | - | |
3608 | | - | |
| 3608 | + | |
| 3609 | + | |
| 3610 | + | |
| 3611 | + | |
3609 | 3612 | | |
3610 | | - | |
3611 | | - | |
| 3613 | + | |
3612 | 3614 | | |
3613 | 3615 | | |
3614 | 3616 | | |
| |||
3627 | 3629 | | |
3628 | 3630 | | |
3629 | 3631 | | |
3630 | | - | |
3631 | | - | |
3632 | | - | |
3633 | | - | |
3634 | | - | |
3635 | | - | |
3636 | | - | |
3637 | | - | |
3638 | | - | |
3639 | | - | |
3640 | | - | |
3641 | | - | |
3642 | | - | |
3643 | | - | |
3644 | | - | |
3645 | | - | |
| 3632 | + | |
3646 | 3633 | | |
3647 | 3634 | | |
3648 | 3635 | | |
| |||
0 commit comments