-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle implicit protocols as well as implicit abc's
- Loading branch information
1 parent
bc2994a
commit 2ca13d8
Showing
5 changed files
with
55 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 20 additions & 4 deletions
24
packages/pyright-internal/src/tests/samples/implicitAbstractClass.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
from abc import ABC, abstractmethod, ABCMeta | ||
from typing import Protocol, override | ||
|
||
class Foo(ABC): | ||
class A(ABC): | ||
@abstractmethod | ||
def asdf(self) -> int: ... | ||
|
||
class Bar(Foo): # error | ||
class B(A): # error | ||
pass | ||
|
||
class Baz(Foo, metaclass=ABCMeta): | ||
class C(A, metaclass=ABCMeta): | ||
pass | ||
|
||
class Qux(Foo, ABC): | ||
class D(A, ABC): | ||
pass | ||
|
||
class E(A): | ||
@override | ||
def asdf(self) -> int: | ||
... | ||
|
||
class F(Protocol): | ||
@abstractmethod | ||
def asdf(self) -> int: ... | ||
|
||
class G(F): # error | ||
pass | ||
|
||
class H(F, Protocol): | ||
pass |