From b0c1d5d96dddbad3b6df10630abfe22a23d7a8fd Mon Sep 17 00:00:00 2001 From: Victorious3 Date: Fri, 26 Aug 2022 16:05:59 +0200 Subject: [PATCH] Remove duplicate type variables --- .../de/dhbwstuttgart/target/generate/ASTToTargetAST.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java b/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java index 4fa1b0a21..fb1ea80ab 100644 --- a/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java +++ b/src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java @@ -411,6 +411,15 @@ public class ASTToTargetAST { } } } while (foundInfima); + + // Remove duplicate bounds + for (var pair : new HashSet<>(input)) { + if (pair instanceof PairTPHequalRefTypeOrWildcardType) { + if (input.stream().anyMatch(p -> p instanceof PairTPHsmallerTPH && p.getLeft().equals(pair.getLeft()))) { + input.remove(pair); + } + } + } } TargetType get(TypePlaceholder tph) {