From 84a5ed2cc31f66a464547bef3ed34fcd801dfacd Mon Sep 17 00:00:00 2001 From: Victorious3 Date: Tue, 21 Feb 2023 11:31:28 +0100 Subject: [PATCH] Fix inner type variables --- .../dhbwstuttgart/target/generate/ASTToTargetAST.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java b/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java index b33f4ea4..541eb761 100644 --- a/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java +++ b/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java @@ -499,15 +499,17 @@ public class ASTToTargetAST { // For eliminating inner type variables we need to figure out which ones are actually used // TODO Maybe don't do this twice? - var referenced = new HashSet(); + var usedTphs = new HashSet(); for (var param : method.getParameterList().getFormalparalist()) { - referenced.addAll(findTypeVariables(param.getType())); + usedTphs.addAll(findTypeVariables(param.getType())); } - referenced.addAll(findTypeVariables(method.getReturnType())); + usedTphs.addAll(findTypeVariables(method.getReturnType())); + var referenced = new HashSet<>(usedTphs); referenced.addAll(typeVariablesOfClass); eliminateInnerTypeVariables(referenced, result); - usedTPHsOfMethods.put(method, referenced); + + usedTPHsOfMethods.put(method, usedTphs); System.out.println(method.name + ": " + result);