Fix the typing for LocalSite.ALL to be more specific.

Review Request #13996 — Created June 24, 2024 and submitted

Information

Review Board
release-7.x

Reviewers

LocalSite.ALL was typed as a Final[_LocalSiteConstants], which
worked fine in some cases, but didn't always match correctly. This is
because, depending on typing, passing a LocalSite.ALL as a
_LocalSiteConstants.ALL could be seen as passing a
_LocalSiteConstants as a _LocalSiteConstants.ALL, which clearly
doesn't match.

Now, LocalSite.ALL is a Final[Literal[_LocalSiteConstants.ALL]],
which helps it always match anything accepting _LocalSiteConstants.ALL
as a type.

Tested this against some in-progress code that was failing to
type correctly.

Checked existing usage of LocalSite.ALL being passed as an
AnyOrAllLocalSites, and found that it was still working as
expected.

Summary ID
Fix the typing for LocalSite.ALL to be more specific.
`LocalSite.ALL` was typed as a `Final[_LocalSiteConstants]`, which worked fine in some cases, but didn't always match correctly. This is because, depending on typing, passing a `LocalSite.ALL` as a `_LocalSiteConstants.ALL` could be seen as passing a `_LocalSiteConstants` as a `_LocalSiteConstants.ALL`, which clearly doesn't match. Now, `LocalSite.ALL` is a `Final[Literal[_LocalSiteConstants.ALL]]`, which helps it always match anything accepting `_LocalSiteConstants.ALL` as a type.
3768b062ef86bff7a19753813067f589389163ab
maubin
  1. Ship It!
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-7.x (c874954)