mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-84461 Don't consider attributes assigned in protocol functions for protocol matching
(cherry picked from commit 5e540caf9f11b78036785cb94d189c91d1899c97) IJ-MR-174248 GitOrigin-RevId: 53c1179c86cda95a72e57cbf08075c6e1b20aa2c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d1cb10773b
commit
59d7739bd6
@@ -3098,4 +3098,31 @@ def foo(param: str | int) -> TypeGuard[str]:
|
||||
public void testStrictUnionImplicitProtocolMatching() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-76822
|
||||
public void testProtocolWithAssignedPropertyInMethod() {
|
||||
doTestByText("""
|
||||
from typing import Protocol
|
||||
|
||||
class Template(Protocol):
|
||||
name: str
|
||||
value: int = 0
|
||||
|
||||
def method(self) -> None:
|
||||
self.name = "name"
|
||||
self.temp: list[int] = []
|
||||
|
||||
|
||||
class Concrete:
|
||||
def __init__(self, name: str, value: int) -> None:
|
||||
self.name = name
|
||||
self.value = value
|
||||
|
||||
def method(self) -> None:
|
||||
return
|
||||
|
||||
|
||||
var: Template = Concrete("value", 42)
|
||||
""");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user