Skip to content

Conversation

hauntsaninja
Copy link
Collaborator

This is @sobolevn 's work from #11128, resubmitting since the old PR can't be saved because Nikita's repo got deleted

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thank you for reviving this!

[case testUnificationEmptySetRight]
def f(): pass
a = {0} if f() else set()
a() # E: "Set[int]" not callable
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
a() # E: "Set[int]" not callable
reveal_type(a()) # N: Revealed type is "Set[int]"

@@ -10,7 +10,8 @@ class object:
class type: pass
class tuple(Generic[T]): pass
class function: pass
class int: pass
class int:
def conjugate(self) -> int: pass
Copy link
Member

Choose a reason for hiding this comment

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

I think we can use our own classes here, so we can simplify the stub

@hauntsaninja hauntsaninja changed the title Fixes type inference for generic calls in if expr [do not merge] Fixes type inference for generic calls in if expr Apr 28, 2023
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