Conformance: broaden enum-expansion tests - #2324
Open
tapetersen wants to merge 2 commits into
Open
Conversation
The spec's Enum Literal Expansion section states that a type checker should treat a complete union of all literal members as equivalent to the enum type. Add test to cover cases failing in some checkers. Also refreshes all three quoted spec passages, which had drifted from the section as rewritten in a6eeccf ("new type system concepts section", Reported in python#2323.
Four checkers accept the full-literal-union equivalency and are unaffected: mypy, pyrefly, pycroscope and ty (mypy and ty remain "Partial" for the pre-existing `Flag` narrowing gap only). Three drop from "Pass" to "Partial": * pyright and zuban reject both the assignment and the `assert_type`. * basilisk rejects only the assignment; it reports the `assert_type` in test1 as redundant, so it does treat the two types as equivalent there.
tapetersen
force-pushed
the
enums-expansion-full-union-assignability
branch
from
July 30, 2026 12:31
36acade to
43b2427
Compare
JelleZijlstra
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The spec's Enum Literal Expansion section states that a type checker
should treat a complete union of all literal members as equivalent to
the enum type. Add test to cover cases failing in some checkers.
Also refreshes all three quoted spec passages, which had drifted from
the section as rewritten in a6eeccf ("new type system concepts section",
Fixes #2323.