Skip to content

Conversation

ddfisher
Copy link
Collaborator

@ddfisher ddfisher commented Jun 9, 2017

Fixes #899. Allows indexing and slicing tuples with nonliteral values: returns a Union of all tuple item types.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

You can merge yourself after fixing up the indent (Curious why flake8 didn't catch this.)

def nonliteral_tuple_index_helper(self, left_type: TupleType, index: Expression) -> Type:
index_type = self.accept(index)
expected_type = UnionType.make_union([self.named_type('builtins.int'),
self.named_type('builtins.slice')])
Copy link
Member

Choose a reason for hiding this comment

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

Indent by one more space. (Was it vim or you that got this wrong?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops! That was me. I forgot to put the arguments in a list originally and failed to reindent after doing so.

Thanks for catching this!

@ilevkivskyi ilevkivskyi merged commit 9941b61 into master Jun 9, 2017
@ilevkivskyi ilevkivskyi deleted the nonliteral-tuple-index branch June 9, 2017 06:34
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