Skip to content

Fix _BoolLiteral not being treated as equivalent to Literal.#72

Merged
dnwpark merged 2 commits intomainfrom
bool-literal
Feb 2, 2026
Merged

Fix _BoolLiteral not being treated as equivalent to Literal.#72
dnwpark merged 2 commits intomainfrom
bool-literal

Conversation

@dnwpark
Copy link
Contributor

@dnwpark dnwpark commented Feb 2, 2026

No description provided.

@vercel
Copy link

vercel bot commented Feb 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
python-typemap Ready Ready Preview, Comment Feb 2, 2026 7:04pm

return is_generic_alias(t) and get_origin(t) is Literal # type: ignore [comparison-overlap]
from typemap.typing import _BoolLiteral

return is_generic_alias(t) and get_origin(t) in (Literal, _BoolLiteral)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make it so that the origin actually is a Literal?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like instead of having _BoolLiteral as its own form, we should create a _BoolLiteralGenericAlias that has a Literal origin.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works!

@dnwpark dnwpark merged commit addcb7a into main Feb 2, 2026
5 checks passed
@dnwpark dnwpark deleted the bool-literal branch February 2, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants