Fixed type naming for dynamically evaluated types (PY-8898).

This commit is contained in:
Dmitry Trofimov
2013-03-27 16:26:47 +01:00
parent 10355b4809
commit ccd116dadc
2 changed files with 13 additions and 2 deletions
@@ -30,4 +30,10 @@ public class PyDynamicallyEvaluatedType extends PyUnionType {
}
return new PyDynamicallyEvaluatedType(members);
}
@Override
public String getName() {
PyType res = excludeNull();
return res != null ? res.getName() : "unknown";
}
}
@@ -163,8 +163,8 @@ public class PyUnionType implements PyType {
/**
* Excludes all subtypes of type from the union
*
* @param type type to exclude. If type is a union all subtypes of union members will be excluded from the union
* If type is null only null will be excluded from the union.
* @param type type to exclude. If type is a union all subtypes of union members will be excluded from the union
* If type is null only null will be excluded from the union.
* @param context
* @return union with excluded types
*/
@@ -186,6 +186,11 @@ public class PyUnionType implements PyType {
return union(members);
}
@Nullable
public PyType excludeNull() {
return exclude(null, null);
}
private static PyType unit(@Nullable PyType type) {
if (type instanceof PyUnionType) {
Set<PyType> members = new LinkedHashSet<PyType>();