8000 Make `None` promotable to `object`, not a subclass, when resolving overloads by benkuhn · Pull Request #3763 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Make None promotable to object, not a subclass, when resolving overloads #3763

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

Closed
wants to merge 4 commits into from
Closed
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
Next Next commit
Test case
  • Loading branch information
benkuhn committed Jul 22, 2017
commit bbcaad84d4e3f5042fefd40dacb4f483d9abe88e
11 changes: 11 additions & 0 deletions test-data/unit/check-optional.test
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,17 @@ def f(x: int) -> int: pass
reveal_type(f(None)) # E: Revealed type is 'builtins.str'
reveal_type(f(0)) # E: Revealed type is 'builtins.int'

[case testOverloadWithObject]
from foo import *
[file foo.pyi]
from typing import overload
@overload
def f(x: None) -> str: pass
@overload
def f(x: object) -> int: pass
reveal_type(f(None)) # E: Revealed type is 'builtins.str'
reveal_type(f(0)) # E: Revealed type is 'builtins.int'

[case testOptionalTypeOrTypePlain]
from typing import Optional
def f(a: Optional[int]) -> int:
Expand Down
0