mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
copletion in case of null in dataflow now works, also fixed case with isinstance with tuple (PY-1133)
This commit is contained in:
@@ -133,7 +133,7 @@ public class PyQualifiedReferenceImpl extends PyReferenceImpl {
|
||||
PyExpression qualifier = myElement.getQualifier();
|
||||
assert qualifier != null;
|
||||
|
||||
PyType qualifierType = qualifier.getType(TypeEvalContext.variants());
|
||||
PyType qualifierType = qualifier.getType(TypeEvalContext.slow());
|
||||
ProcessingContext ctx = new ProcessingContext();
|
||||
final Set<String> namesAlready = new HashSet<String>();
|
||||
ctx.put(PyType.CTX_NAMES, namesAlready);
|
||||
|
||||
@@ -280,7 +280,7 @@ public class PyReferenceExpressionImpl extends PyElementImpl implements PyRefere
|
||||
if (defs.length > 0) {
|
||||
PyType type = getTypeIfExpr(defs[0], context);
|
||||
for (int i = 1; i < defs.length; i++) {
|
||||
type = PyUnionType.union(type, getTypeIfExpr(defs[i], context), context.allowNulls());
|
||||
type = PyUnionType.union(type, getTypeIfExpr(defs[i], context));
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -55,19 +55,6 @@ public class PyUnionType implements PyType {
|
||||
}, ", ") + ")";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PyType union(PyType type1, PyType type2, boolean allowNulls) {
|
||||
if (allowNulls) {
|
||||
if (type1 == null) {
|
||||
return type2;
|
||||
}
|
||||
if (type2 == null) {
|
||||
return type1;
|
||||
}
|
||||
}
|
||||
return union(type1, type2);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PyType union(PyType type1, PyType type2) {
|
||||
if (type1 instanceof PyTupleType && type2 instanceof PyTupleType) {
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.Map;
|
||||
*/
|
||||
public class TypeEvalContext {
|
||||
private boolean myAllowDataFlow;
|
||||
private boolean allowNulls = false;
|
||||
|
||||
private Map<PyExpression, PyType> myEvaluated = new HashMap<PyExpression, PyType>();
|
||||
|
||||
@@ -27,15 +26,6 @@ public class TypeEvalContext {
|
||||
return myAllowDataFlow;
|
||||
}
|
||||
|
||||
|
||||
public static TypeEvalContext variants() {
|
||||
TypeEvalContext context = slow();
|
||||
context.allowNulls = true;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
public static TypeEvalContext slow() {
|
||||
return new TypeEvalContext(true);
|
||||
}
|
||||
@@ -53,8 +43,4 @@ public class TypeEvalContext {
|
||||
myEvaluated.put(expr, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean allowNulls() {
|
||||
return allowNulls;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user