mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-20057 Partially support type checking between type and typing.Type[]
This commit is contained in:
@@ -69,10 +69,15 @@ public class PyTypeChecker {
|
||||
final PyClassType classType = (PyClassType)actual;
|
||||
final PyBuiltinCache builtinCache = PyBuiltinCache.getInstance(classType.getPyClass());
|
||||
|
||||
if (actual == builtinCache.getObjectType(PyNames.BASESTRING)) {
|
||||
if (actual.equals(builtinCache.getObjectType(PyNames.BASESTRING))) {
|
||||
return match(expected, builtinCache.getStrOrUnicodeType(), context, substitutions, recursive);
|
||||
}
|
||||
}
|
||||
if (expected instanceof PyClassType &&
|
||||
expected.equals(PyBuiltinCache.getInstance(((PyClassType)expected).getPyClass()).getTypeType()) &&
|
||||
actual instanceof PyInstantiableType && ((PyInstantiableType)actual).isDefinition()) {
|
||||
return true;
|
||||
}
|
||||
if (expected instanceof PyInstantiableType && actual instanceof PyInstantiableType
|
||||
&& ((PyInstantiableType)expected).isDefinition() ^ ((PyInstantiableType)actual).isDefinition()) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user