Add tests and partial fixes for issues #547, #548, #549, #550 #551
+358
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive test cases for four reported Pyrefly issues and includes a partial fix for issue #549.
Changes
Issue #547: Dict narrowing after None checks
issue_547_dict_narrowing.rs
Optional[Dict]
afteris not None
checksIssue #548: Pydantic Field overload resolution
issue_548_pydantic_field.rs
showing expected behavior_Unset
) in type stubsField(default=value, ...)
instead ofField(value, ...)
)Issue #549: False positives on union types with Any
type_contains_any()
helper inattr.rs
Any
is present in a union, allows any attribute access without errorsissue_549_any_union.rs
verify the fixDict[str, Any]
subscript still needs separate handlingIssue #550: Init helper methods
issue_550_init_helpers.rs
documenting the limitation__init__
aren't recognized as constructors__init__
Test Results
All new tests pass:
Benefits
Related Issues
Fixes #547 (tests confirm it's already fixed)
Partially addresses #549 (union+Any case)
Documents workarounds for #548 and #550