From e598e3783d779a3ead5f76280baffb2480c508e5 Mon Sep 17 00:00:00 2001 From: Panagiotis Kourouklidis <22411884+pkourouklidis@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:50:55 +0000 Subject: [PATCH] change the parents of an EolUnionType --- .../eol/staticanalyser/types/EolUnionType.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/org.eclipse.epsilon.eol.engine/src/org/eclipse/epsilon/eol/staticanalyser/types/EolUnionType.java b/plugins/org.eclipse.epsilon.eol.engine/src/org/eclipse/epsilon/eol/staticanalyser/types/EolUnionType.java index 2e941b8ba..bc3540c80 100644 --- a/plugins/org.eclipse.epsilon.eol.engine/src/org/eclipse/epsilon/eol/staticanalyser/types/EolUnionType.java +++ b/plugins/org.eclipse.epsilon.eol.engine/src/org/eclipse/epsilon/eol/staticanalyser/types/EolUnionType.java @@ -37,8 +37,17 @@ public boolean isAbstract() { } @Override - public List getParentTypes(){ - return new ArrayList(containedTypes); + public List getParentTypes() { + Set parentsOfContained = containedTypes.stream().flatMap(t -> t.getParentTypes().stream()) + .collect(Collectors.toSet()); + if (parentsOfContained.size() == 1) { + return new ArrayList(parentsOfContained); + } else { + EolUnionType t = new EolUnionType(parentsOfContained); + List r = new ArrayList(); + r.add(t); + return r; + } } @Override