8000 Allow covariant args in constructor by ilevkivskyi · Pull Request #2888 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Allow covariant args in constructor #2888

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 3 commits into from
Feb 21, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add fixture
  • Loading branch information
Ivan Levkivskyi committed Feb 21, 2017
commit 998d623f4288b692b70af9d2ee9f52310c55a85f
1 change: 1 addition & 0 deletions test-data/unit/check-classes.test
Original file line number Diff line number Diff line change
Expand Up @@ -1950,6 +1950,7 @@ T_co = TypeVar('T_co', covariant=True)
class C(Generic[T_co]):
def __init__(self, x: T_co) -> None: # This should be allowed
pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also try assignment self.x = x in __init__ and reveal_type(self.x) in a method other than __init__.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in a new commit.

[builtins fixtures/property.pyi]
[out]

[case testTypeUsingTypeCErrorCovariance]
Expand Down
0