mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Don't apply substitution from ancestor if class defines its own type variable (PY-27783)
This commit is contained in:
@@ -953,6 +953,27 @@ public class Py3TypeTest extends PyTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
// PY-27783
|
||||
public void testApplyingSuperSubstituionToGenericClass() {
|
||||
runWithLanguageLevel(
|
||||
LanguageLevel.PYTHON36,
|
||||
() -> doTest("Dict[T, int]",
|
||||
"from typing import TypeVar, Generic, Dict, List\n" +
|
||||
"\n" +
|
||||
"T = TypeVar('T')\n" +
|
||||
"\n" +
|
||||
"class A(Generic[T]):\n" +
|
||||
" pass\n" +
|
||||
"\n" +
|
||||
"class B(A[List[T]], Generic[T]):\n" +
|
||||
" def __init__(self) -> None:\n" +
|
||||
" self.value_set: Dict[T, int] = {}\n" +
|
||||
"\n" +
|
||||
" def foo(self) -> None:\n" +
|
||||
" expr = self.value_set")
|
||||
);
|
||||
}
|
||||
|
||||
private void doTest(final String expectedType, final String text) {
|
||||
myFixture.configureByText(PythonFileType.INSTANCE, text);
|
||||
final PyExpression expr = myFixture.findElementByText("expr", PyExpression.class);
|
||||
|
||||
Reference in New Issue
Block a user