From 44f862512d8d88e2829cfca167d9a7d250ea49af Mon Sep 17 00:00:00 2001 From: Moritz Dieing <63721811+moritzdieing@users.noreply.github.com> Date: Wed, 10 Feb 2021 10:11:17 +0100 Subject: [PATCH] Handle multiple type assumptions with same var --- .../edu/kit/typicalc/view/main/TypeAssumptionsArea.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/kit/typicalc/view/main/TypeAssumptionsArea.java b/src/main/java/edu/kit/typicalc/view/main/TypeAssumptionsArea.java index 7e3de2c..a4fe363 100644 --- a/src/main/java/edu/kit/typicalc/view/main/TypeAssumptionsArea.java +++ b/src/main/java/edu/kit/typicalc/view/main/TypeAssumptionsArea.java @@ -101,13 +101,15 @@ public class TypeAssumptionsArea extends Dialog implements LocaleChangeObserver } /** - * Returns the current type assumptions. + * Returns the current type assumptions. If multiple type assumptions contain the same variable only the + * oldest type assumption is returned. All other type assumptions are being ignored. * * @return the current type assumptions as mappings from a variable to a type */ protected Map getTypeAssumptions() { return fields.stream() - .collect(Collectors.toMap(TypeAssumptionField::getVariable, TypeAssumptionField::getType)); + .collect(Collectors.toMap(TypeAssumptionField::getVariable, TypeAssumptionField::getType, + (existing, replacement) -> existing)); } @Override