Skip to content

Conversation

ilevkivskyi
Copy link
Member

Fixes #1485

Tuple fallback was overlooked in constraint inference. As usual, I place nominal before structural.

@@ -373,11 +373,12 @@ def visit_instance(self, template: Instance) -> List[Constraint]:
cb = infer_constraints(template.args[0], item, SUPERTYPE_OF)
res.extend(cb)
return res
elif isinstance(actual, TupleType) and self.direction == SUPERTYPE_OF:
return infer_constraints(template, actual.fallback, self.direction)
elif (isinstance(actual, TupleType) and template.type.is_protocol and
Copy link

Choose a reason for hiding this comment

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

I don't see how this branch can ever be entered - when this condition is true, the condition of the branch above will be true, and this won't get entered.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this branch is redundant now.

@JukkaL
Copy link
Collaborator

JukkaL commented Nov 15, 2017

Can you fix the merge conflict?

@ilevkivskyi
Copy link
Member Author

Fixed!

Appveyor failure is a flake.

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix!

@JukkaL JukkaL merged commit 67ff4cf into python:master Nov 15, 2017
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