Implement matching types against protocols (PY-26628)

Update PyTypeChecker to prevent recursion while matching types.
SOE was received while matching `self` parameters for methods inside protocol and other class.
This commit is contained in:
Semyon Proshev
2018-02-05 20:58:29 +03:00
parent 77e5e45220
commit 5eecc4b814
11 changed files with 414 additions and 33 deletions
@@ -470,4 +470,44 @@ public class PyTypeCheckerInspectionTest extends PyInspectionTestCase {
public void testModuleWithGetAttr() {
runWithLanguageLevel(LanguageLevel.PYTHON37, this::doMultiFileTest);
}
// PY-26628
public void testAgainstTypingProtocol() {
runWithLanguageLevel(LanguageLevel.PYTHON35, this::doTest);
}
// PY-26628
public void testAgainstTypingProtocolWithImplementedMethod() {
runWithLanguageLevel(LanguageLevel.PYTHON35, this::doTest);
}
// PY-26628
public void testAgainstTypingProtocolWithImplementedVariable() {
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
}
// PY-26628
public void testAgainstMergedTypingProtocols() {
runWithLanguageLevel(LanguageLevel.PYTHON35, this::doTest);
}
// PY-26628
public void testAgainstGenericTypingProtocol() {
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
}
// PY-26628
public void testAgainstRecursiveTypingProtocol() {
runWithLanguageLevel(LanguageLevel.PYTHON35, this::doTest);
}
// PY-26628
public void testAgainstTypingProtocolWrongTypes() {
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
}
// PY-26628
public void testTypingProtocolAgainstProtocol() {
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
}
}