-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
Consider the following code:
from abc import ABC, abstractmethod
import mailbox
class MailboxFactory(ABC):
@abstractmethod
def open(self) -> mailbox.Mailbox: ...
class MboxFactory(MailboxFactory):
def __init__(self, path: str) -> None:
self.path = path
def open(self) -> mailbox.mbox:
return mailbox.mbox(self.path)I'm 90% sure this should be acceptable, but running 1.18.2 on this code produces the error:
mailbox02.py:14: error: Return type "mbox" of "open" incompatible with return type "Mailbox[Message[str, str]]" in supertype "MailboxFactory" [override]
Found 1 error in 1 file (checked 1 source file)
Similar errors happen for other Mailbox subclasses as well.
Metadata
Metadata
Assignees
Labels
No labels