Skip to content
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

Tuple[..., fallback=T] isn't a subtype of T #1558

Closed
rwbarton opened this issue May 20, 2016 · 2 comments
Closed

Tuple[..., fallback=T] isn't a subtype of T #1558

rwbarton opened this issue May 20, 2016 · 2 comments

Comments

@rwbarton
Copy link
Contributor

rwbarton commented May 20, 2016

A program like this ought to type check, but doesn't:

from typing import NamedTuple

class A: pass
def f(x: A) -> None: pass

class B(NamedTuple('B', [('i', int)]), A): pass
f(B(1))  # E: Argument 1 to "f" has incompatible type "B"; expected "A"

(Fixing this wouldn't help with #1432 without adding the reverse subtyping relation as well, but it would fix #1485 as long as constraint inference is also updated accordingly.)

@ddfisher ddfisher added this to the 0.5 milestone Aug 18, 2016
elazarg added a commit to elazarg/mypy that referenced this issue Sep 3, 2016
JukkaL pushed a commit that referenced this issue Sep 8, 2016
Solve issue #1558 by delegate subtype checks on TupleType to fallback.

This does not solve #1485. I don't know why.
@gvanrossum gvanrossum removed this from the 0.5 milestone Mar 29, 2017
@elazarg
Copy link
Contributor

elazarg commented Apr 3, 2017

There's no such error now. I think #2091 fixed this.

@ilevkivskyi
Copy link
Member

Yes, it looks like this has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants