You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On master and 0.630, the following code fails with error: Incompatible return value type (got "Foo", expected "T"):
from dataclasses import dataclass
import typing as t
T = t.TypeVar('T', bound="Foo")
@dataclass
class Foo:
@classmethod
def make(cls: t.Type[T]) -> T:
return cls()
If I remove the dataclass annotation, it works fine.
Activity
JelleZijlstra commentedon Nov 29, 2018
cc @euresti since this seems to be due to the dataclasses plugin.
euresti commentedon Nov 29, 2018
Hmm. In my code I usually annotate this as:
But I hardly use inheritance.
Also I don't know why the decorator would break it. Does it happens with
@attr.s?ilevkivskyi commentedon Nov 29, 2018
This works on master
ilevkivskyi commentedon Nov 29, 2018
Also this is a duplicate of #5263 that was fixed by #5646