Skip to content

Fix generic function overloading with tuple types #1596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2016

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented May 30, 2016

Fixes #1595.

There were actually two issues:

  • Erasing tuple types was incorrect, as the fallback type was not erased.
  • Some tuple types got generated without a type argument, even though
    a uniform tuple type is internally represented as instance type tuple[t].

Similar issues might still arise in other contexts but at least this is
improves things a little.

Also, we generate fallback types that are like Tuple[Any, ...]. We could
potentially generate a more precise fallback type, but that would potentially
require joins and I'm not sure if we can use them during semantic analysis.

Fixes #1595.

There were actually two issues:

* Erasing tuple types was incorrect, as the fallback type was not erased.
* Some tuple types got generated without a type argument, even though
  a uniform tuple type is internally represented as instance type tuple[t].

Similar issues might still arise in other contexts but at least this is
improves things a little.

Also, we generate fallback types that are like Tuple[Any, ...]. We could
potentially generate a more precise fallback type, but that would potentially
require joins and I'm not sure if we can use them during semantic analysis.
@gvanrossum gvanrossum merged commit ccc7f53 into master May 30, 2016
@gvanrossum
Copy link
Member

Thanks for the quick fix! There are a few issues left with python/typeshed#223 but way fewer than before (only one per repo) and of a different nature.

@rwbarton
Copy link
Contributor

I'm glad the bare tuple types are gone, I was confused about whether those were intentional and they were causing problems for something I was working on involving constraints.

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