Skip to content

Conversation

@pkch
Copy link
Contributor

@pkch pkch commented Mar 14, 2017

Fix #2994

Useless without python/typeshed#998 (because parser will just choke on the nested tuples anyway). But since there are no tests for nested tuples, this PR is not strictly blocked by that other one.

@gvanrossum
Copy link
Member

Can you add a unit test please?

if isinstance(x, (str, (int, tuple))):
x[1] # E: Value of type "Union[int, str, tuple]" is not indexable
else:
x[1]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add reveal_type(x) here.

x[1] # E: Value of type "Union[int, str, tuple]" is not indexable
else:
x[1]
if isinstance(x, (str, (list,))):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add reveal_type(x) before the if statement and within the if body.

@JukkaL
Copy link
Collaborator

JukkaL commented Mar 18, 2017

Thanks, LGTM!

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.

3 participants