Skip to content

Fix generic function overloading with tuple types#1596

Merged
gvanrossum merged 1 commit intomasterfrom
tuple-generic-overload
May 30, 2016
Merged

Fix generic function overloading with tuple types#1596
gvanrossum merged 1 commit intomasterfrom
tuple-generic-overload

Conversation

@JukkaL
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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