Skip to content

Fix UnsetType truthiness narrowing in type stubs#975

Open
overlorde wants to merge 1 commit intojcrist:mainfrom
overlorde:fix-unset-type-narrowing
Open

Fix UnsetType truthiness narrowing in type stubs#975
overlorde wants to merge 1 commit intojcrist:mainfrom
overlorde:fix-unset-type-narrowing

Conversation

@overlorde
Copy link

Summary

  • Add __bool__() -> Literal[False] to UnsetType stub so type checkers can narrow T | UnsetType via truthiness (if x:)
  • Add typing test for truthiness-based narrowing

Closes #916

@overlorde
Copy link
Author

CI note: both failures are unrelated to this change.

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.

UnsetType union types lowering is incomplete

1 participant