diff --git a/src/de/dhbwstuttgart/typeinference/unify/Unify.java b/src/de/dhbwstuttgart/typeinference/unify/Unify.java index 92dd8e56..9a990f4c 100755 --- a/src/de/dhbwstuttgart/typeinference/unify/Unify.java +++ b/src/de/dhbwstuttgart/typeinference/unify/Unify.java @@ -1373,35 +1373,21 @@ throws MatchException //REDUCE2 //PL 15-01-20: HIER MUESSEN NOCH ALLE FAELLE MIT EXTENDS UND SUPER GEMISCHT ERGAENZT WERDEN //BEACHTEN: WAS PASSIERT WENN HINTER ? extends/super EINE TYPVAR/KEIN REFTYPE STEHT + //erledigt 15-02-03 if(P.OperatorEqual()) { - //wenn noetig extends-wildcards entfernen PL 15-01-30 + //wenn noetig extends-wildcards entfernen PL 15-02-03 //korrekt da P.OperatorEqual() - if(P.TA1 instanceof ExtendsWildcardType && P.TA2 instanceof ExtendsWildcardType) + + if(P.TA1 instanceof WildcardType) { - ExtendsWildcardType exT1 = (ExtendsWildcardType)P.TA1; - ExtendsWildcardType exT2 = (ExtendsWildcardType)P.TA2; - - H.addElement(new Pair(exT1.get_ExtendsType(), exT2.get_ExtendsType())); - - bRegel = true; - continue; - + P.TA1 = ((WildcardType)P.TA1).GetWildcardType(); } - - //wenn noetig super-wildcards entfernen PL 15-01-30 - //korrekt da P.OperatorEqual() - if(P.TA1 instanceof SuperWildcardType && P.TA2 instanceof SuperWildcardType) - { - SuperWildcardType suT1 = (SuperWildcardType)P.TA1; - SuperWildcardType suT2 = (SuperWildcardType)P.TA2; - - H.addElement(new Pair(suT1.get_SuperType(), suT2.get_SuperType())); - - bRegel = true; - continue; - + if(P.TA2 instanceof WildcardType) { + P.TA2 = ((WildcardType)P.TA2).GetWildcardType(); } + + RefType TA1 = null; RefType TA2 = null; //Hier werden die RefTypes gefüllt. @@ -1410,29 +1396,7 @@ throws MatchException TA1 = (RefType)P.TA1; TA2 = (RefType)P.TA2; } - /* auskommentiert 15-01-30, da dies nict nur für RefTypes sonder für alle Typen gilt, am Anfang eingefügt. - //FALSCH - else if(P.TA1 instanceof ExtendsWildcardType && P.TA2 instanceof ExtendsWildcardType) //nicht mehr noetig, wird bereits am Anfang der Schleife entfernt - { - ExtendsWildcardType exT1 = (ExtendsWildcardType)P.TA1; - ExtendsWildcardType exT2 = (ExtendsWildcardType)P.TA2; - if(exT1.get_ExtendsType() instanceof RefType && exT2.get_ExtendsType() instanceof RefType) - { - TA1 = (RefType)exT1.get_ExtendsType(); - TA2 = (RefType)exT2.get_ExtendsType(); - } - } - else if(P.TA1 instanceof SuperWildcardType && P.TA2 instanceof SuperWildcardType) //nicht mehr noetig, wird bereits am Anfang der Schleife entfernt - { - SuperWildcardType suT1 = (SuperWildcardType)P.TA1; - SuperWildcardType suT2 = (SuperWildcardType)P.TA2; - if(suT1.get_SuperType() instanceof RefType && suT2.get_SuperType() instanceof RefType) - { - TA1 = (RefType)suT1.get_SuperType(); - TA2 = (RefType)suT2.get_SuperType(); - } - } - */ + if(TA1 != null && TA2 != null && TA1.getTypeName().equals(TA2.getTypeName())) { inferencelog.debug(" REDUCE2"); diff --git a/test/plugindevelopment/TypeInsertTests/LambdaTest5.jav b/test/plugindevelopment/TypeInsertTests/LambdaTest5.jav index 5476e7b3..4c00bc85 100644 --- a/test/plugindevelopment/TypeInsertTests/LambdaTest5.jav +++ b/test/plugindevelopment/TypeInsertTests/LambdaTest5.jav @@ -1,5 +1,5 @@ class LambdaTest{ -Fun1 op = (var) -> {return var;}; +Fun1 op = (var) -> {return var;}; } \ No newline at end of file