public InferredType hoistUnions() { List<InferredType> newUnionTypes = new ArrayList<InferredType>(); for (InferredType it : unionTypes) { if (it instanceof UnionType) { UnionType subUnion = (UnionType) it; for (InferredType it2 : subUnion.unionTypes) { newUnionTypes.add(it2.hoistUnions()); } } else { newUnionTypes.add(it.hoistUnions()); } } return new UnionType(newUnionTypes); }
public InferredType hoistUnions() { List<InferredType> newStructTypes = new ArrayList<InferredType>(); for (InferredType it : structTypes) { newStructTypes.add(it.hoistUnions()); } return new StructType(newStructTypes); }
public InferredType hoistUnions() { return new ArrayType(bodyType.hoistUnions()); }