FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Is there a way to check return type error incompatible with supertype? · Issue #81 · google/pytype · GitHub

This repository was archived by the owner on Sep 3, 2026. It is now read-only.
/ pytype Public archive
This repository was archived by the owner on Sep 3, 2026. It is now read-only.

Is there a way to check return type error incompatible with supertype? #81

Description

For such an example:

from abc import ABCMeta, abstractmethod
from typing import Callable, Type, TypeVar, Any

class A(metaclass=ABCMeta):
    @abstractmethod
    def foo(self, x: int) -> Any: pass

    @abstractmethod
    def bar(self) -> str: pass

class B(A):
    def foo(self, x: int) -> None: ...
    def bar(self) -> int:
        return 1

#a = A()  # Error: A is abstract
b = B()  # OK

Mypy will complain the following error:
a.py:13: error: Return type of "bar" incompatible with supertype "A"

However pytype seems to ignore such an error.
Is there a way to check return type error incompatible with supertype? Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL