Closed
Description
Setting show_none_errors in the config file causes descriptor-based attributes to no longer be detected. Instead, even when called on an instance, they return the type of the property itself.
Minimal code for reproduction:
test.py
from typing import Generic, TypeVar, overload, Any, Union
import datetime as dt
T = TypeVar('T')
class Column(Generic[T]):
@overload
def __get__(self, instance: None, owner: Any) -> "Column[T]": ...
@overload
def __get__(self, instance: object, owner: Any) -> T: ...
def __get__(self, instance: Union[None, object], owner: Any) -> "Union[Column[T], T]": ...
class MyClass:
prop: Column[dt.date] = Column()
reveal_type(MyClass.prop)
reveal_type(MyClass().prop)
mypy.ini:
[mypy]
python_version = 3.6
#show_none_errors = False
This yields the following (expected) result:
test.py:17: error: Revealed type is 'test3.Column[datetime.date*]'
test.py:18: error: Revealed type is 'datetime.date*'
However, uncommenting the show_none_errors line modifies the output into:
test.py:17: error: Revealed type is 'test3.Column[datetime.date*]'
test.py:18: error: Revealed type is 'test3.Column[datetime.date*]'