From 87fe51767ccf3660f95851260820cbe49d64ec43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Fri, 9 Feb 2018 22:55:40 +0100 Subject: [PATCH] modified: src/de/dhbwstuttgart/typeinference/unify/RuleSet.java Reduce 1 C und D koennen auch gleich sein. Muss nochmals ueberprueft werden. --- .../dhbwstuttgart/typeinference/unify/RuleSet.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java b/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java index 8c41660b..d409d0da 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java +++ b/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java @@ -241,6 +241,20 @@ public class RuleSet implements IRuleSet{ UnifyType cFromFc = fc.getLeftHandedType(c.getName()).orElse(null); + NOCHMAL UEBERPRUEFEN + //PL 18-02-09 Eingfuegt Anfang + //C und D koennen auch gleich sein. + if (c.getName().equals(d.getName())) { + Set result = new HashSet<>(); + TypeParams rhsTypeParams = d.getTypeParams(); + TypeParams lhsTypeParams = c.getTypeParams(); + for(int rhsIdx = 0; rhsIdx < c.getTypeParams().size(); rhsIdx++) + result.add(new UnifyPair(lhsTypeParams.get(rhsIdx), rhsTypeParams.get(rhsIdx), PairOperator.SMALLERDOTWC)); + + return Optional.of(result); + } + //PL 18-02-09 Eingfuegt ENDE + if(cFromFc == null || !cFromFc.getTypeParams().arePlaceholders()) return Optional.empty();