From 520960fea1b4a680dc00db0c084c9581b371521e Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Sun, 29 Aug 2021 15:43:02 +0200 Subject: [PATCH] Improve display of unification errors --- .../latexcreator/LatexCreatorConstraints.java | 6 +----- src/main/resources/language/translation_de.properties | 4 ++-- src/main/resources/language/translation_en.properties | 6 ++---- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/latexcreator/LatexCreatorConstraints.java b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/latexcreator/LatexCreatorConstraints.java index ec7193c..9ac701a 100644 --- a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/latexcreator/LatexCreatorConstraints.java +++ b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/latexcreator/LatexCreatorConstraints.java @@ -342,12 +342,8 @@ public class LatexCreatorConstraints implements StepVisitor { } latex.delete(latex.length() - LATEX_NEW_LINE.length(), latex.length()); latex.append(SPLIT_END); - if (error.isPresent()) { - latex.append(LATEX_NEW_LINE + LATEX_NEW_LINE + AMPERSAND + TEXT + CURLY_LEFT); - latex.append(translationProvider.apply(error.get())); - latex.append(CURLY_RIGHT); - } latex.append(ALIGN_END + MATH_END); + error.ifPresent(unificationError -> latex.append(translationProvider.apply(unificationError))); steps.add(latex.toString()); } return steps; diff --git a/src/main/resources/language/translation_de.properties b/src/main/resources/language/translation_de.properties index 0f25bc8..a07868c 100644 --- a/src/main/resources/language/translation_de.properties +++ b/src/main/resources/language/translation_de.properties @@ -186,9 +186,9 @@ root.absLetLatex=\ \\end{prooftree} root.infinite_type = Der eingegebene Term ist nicht typisierbar: \ - Durch den {\\color{#f00}hervorgehobenen} Constraint würde sich ein unendlicher Typ ergeben! +Durch den hervorgehobenen} Constraint würde sich ein unendlicher Typ ergeben! root.different_types = Der eingegebene Term ist nicht typisierbar: \ - In dem {\\color{#f00}hervorgehobenen} Constraint werden zwei unvereinbare Typen gleichgesetzt! +In dem hervorgehobenen Constraint werden zwei unvereinbare Typen gleichgesetzt! share.heading=Teilen share.url.label=URL diff --git a/src/main/resources/language/translation_en.properties b/src/main/resources/language/translation_en.properties index 45e172a..bad6388 100644 --- a/src/main/resources/language/translation_en.properties +++ b/src/main/resources/language/translation_en.properties @@ -174,10 +174,8 @@ root.absLetLatex=\ \\BinaryInfC{$\\Gamma \\vdash \\lambda \\texttt{x}.t : \\tau_1 \\rightarrow \\tau_2$}\ \\end{prooftree} -root.infinite_type = The entered term cannot be typed: \ - The {\\color{#f00}highlighted} constraint would cause an infinite type! -root.different_types = The entered term cannot be typed: \ - The {\\color{#f00}highlighted} constraint contains two incompatible types! +root.infinite_type = The entered term cannot be typed: The highlighted constraint would cause an infinite type! +root.different_types = The entered term cannot be typed: The highlighted constraint contains two incompatible types! share.heading=Share share.url.label=URL