From 5c97d80eb086e9e0471252990693a6a168d5b64a Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Thu, 6 Feb 2020 18:35:33 +0100 Subject: [PATCH] modified: src/main/java/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java modified: src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java --- .../syntaxtree/type/TypePlaceholder.java | 6 ++++++ .../typeinference/typeAlgo/TYPEStmt.java | 14 ++------------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java b/src/main/java/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java index 533ea9a0..73cd2df7 100644 --- a/src/main/java/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java +++ b/src/main/java/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java @@ -19,6 +19,10 @@ public class TypePlaceholder extends RefTypeOrTPHOrWildcardOrGeneric { private final String name; + /** + * wird bisher nicht genutzt + * setVariance muss ggf. auskommentiert werden. + */ int variance = 0; @@ -70,9 +74,11 @@ public class TypePlaceholder extends RefTypeOrTPHOrWildcardOrGeneric return name; } + /* wird bisher nicht genutzt public void setVariance(int variance) { this.variance= variance; } + */ public int getVariance() { return this.variance; diff --git a/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java b/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java index aca5912e..af1ba5ed 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java @@ -573,17 +573,10 @@ public class TYPEStmt implements StatementVisitor{ */ RefTypeOrTPHOrWildcardOrGeneric retType = assumption.getReceiverType(resolver); - RefTypeOrTPHOrWildcardOrGeneric zwSp; - methodConstraint.add(new Pair(zwSp = forMethod.receiver.getType(), retType, + methodConstraint.add(new Pair(forMethod.receiver.getType(), retType, PairOperator.SMALLERDOT)); - if (zwSp instanceof TypePlaceholder) { - ((TypePlaceholder) zwSp).setVariance(1); - } - methodConstraint.add(new Pair(assumption.getReturnType(resolver), zwSp = forMethod.getType(), + methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT)); - if (zwSp instanceof TypePlaceholder) { - ((TypePlaceholder) zwSp).setVariance(-1); - } methodConstraint.addAll(generateParameterConstraints(forMethod, assumption, info, resolver)); return methodConstraint; } @@ -596,9 +589,6 @@ public class TYPEStmt implements StatementVisitor{ RefTypeOrTPHOrWildcardOrGeneric argType = foMethod.arglist.getArguments().get(i).getType(); RefTypeOrTPHOrWildcardOrGeneric assType = assumption.getArgTypes(resolver).get(i); ret.add(new Pair(argType, assType, PairOperator.SMALLERDOT)); - if (argType instanceof TypePlaceholder) { - ((TypePlaceholder) argType).setVariance(1); - } } return ret; }