Skip to content

New conformance tag '# E[tag!]' to require at least one success - #2354

Open
srittau wants to merge 1 commit into
python:mainfrom
srittau:one-success
Open

New conformance tag '# E[tag!]' to require at least one success#2354
srittau wants to merge 1 commit into
python:mainfrom
srittau:one-success

Conversation

@srittau

@srittau srittau commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Extracted from #2353.

Necessary for pyrefly, which accepts both assert_type(X, float) and assert_type(X, float | int), which other type checkers only accept either.

Not super happy with the syntax, any other suggestions welcome.

@davidhalter

Copy link
Copy Markdown
Collaborator

I don't mind this, but just so you know: I generally just tried to work around this by not using int in these scenarios and using str literals instead, which don't have the promotion issues. In your specific case I might have used:

bare3: Final = [1]  # infer bare3 as Final[list[int]]

I don't think that the promotion details matter for readers of the spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants