From 94c32609c6eb343a9d1faea436ec3c900e734c59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Thu, 7 Mar 2019 13:37:08 +0100 Subject: [PATCH] modified: ../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java disableCondWildcards wird aufgerufen modified: ../../../main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java /** * wenn in einem Paar bestehend aus 2 Typvariablen eine nicht wildcardtable ist, * so beide auf nicht wildcardtable setzen */ public void disableCondWildcards() eingefuegt --- .../typeinference/unify/TypeUnifyTask.java | 1 + .../typeinference/unify/model/UnifyPair.java | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index 1d383c66..b26ee13b 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -531,6 +531,7 @@ public class TypeUnifyTask extends RecursiveTask>> { Set eq0 = applyTypeUnificationRules(eq, fc); + eq0.forEach(x -> x.disableCondWildcards()); /* * Step 2 and 3: Create a subset eq1s of pairs where both sides are TPH and eq2s of the other pairs diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java index 19f6010f..d03b9f85 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java @@ -177,6 +177,16 @@ public class UnifyPair { } } + public void disableCondWildcards() { + if (lhs instanceof PlaceholderType && rhs instanceof PlaceholderType + && (!((PlaceholderType)lhs).isWildcardable() || !((PlaceholderType)rhs).isWildcardable())) + { + ((PlaceholderType)lhs).disableWildcardtable(); + ((PlaceholderType)rhs).disableWildcardtable(); + } + + } + public Boolean wrongWildcard() { return lhs.wrongWildcard() || rhs.wrongWildcard(); }