Skip to content

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

Merged
dnwpark merged 2 commits into
mainfrom
bool-literal
Feb 2, 2026
Merged

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

Conversation

@dnwpark

@dnwpark dnwpark commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@vercel

vercel Bot commented Feb 2, 2026

Copy link
Copy Markdown

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

Comment thread typemap/type_eval/_typing_inspect.py Outdated
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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