## Summary Fixes https://github.com/astral-sh/ty/issues/1409 This PR allows `Final` instance attributes to be initialized in `__init__` methods, as mandated by the Python typing specification (PEP 591). Previously, ty incorrectly prevented this initialization, causing false positive errors. The fix checks if we're inside an `__init__` method before rejecting Final attribute assignments, allowing assignments during instance initialization while still preventing reassignment elsewhere. ## Test Plan - Added new test coverage in `final.md` for the reported issue with `Self` annotations - Updated existing tests that were incorrectly expecting errors - All 278 mdtest tests pass - Manually tested with real-world code examples --------- Co-authored-by: Carl Meyer <carl@astral.sh>
Markdown files within the mdtest/ subdirectory are tests of type inference and type checking;
executed by the tests/mdtest.rs integration test.
See crates/ty_test/README.md for documentation of this test format.