Skip to content

Conversation

@alanhdu
Copy link
Contributor

@alanhdu alanhdu commented Nov 14, 2025

Summary

By using Sequence, these become covariant. Previously, doing something like:

    VALID = [
        ValidTestCase("..."),
        ValidTestCase("..."),
    ]

would be a type error in pyre, because pyre would infer this to be a list[ValidTestCase] which is not a subclass of list[str | ValidTestCase]. By making these Sequences (and thus immutable), we can avoid the requirement of having explicit type annotations everywhere for this.

Test Plan

By using `Sequence`, these become covariant. Previously, doing something like:
```
    VALID = [
        ValidTestCase("..."),
        ValidTestCase("..."),
    ]
```

would be a type error in `pyre`, because `pyre` would infer this to be a `list[ValidTestCase]` which is *not* a subclass of `list[str | ValidTestCase]`. By making these `Sequence`s (and thus immutable), we can avoid the requirement of having explicit type annotations everywhere for this.
@alanhdu alanhdu requested a review from amyreese as a code owner November 14, 2025 19:14
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 14, 2025
@amyreese amyreese merged commit ab5dea2 into Instagram:main Nov 15, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants