From 2a44773403cef381faecb19c02dd1c4196c22f71 Mon Sep 17 00:00:00 2001 From: Andreas Stadelmeier Date: Thu, 1 Feb 2024 12:06:10 +0000 Subject: [PATCH] Update src/test/java/typeinference/UnifyTest.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Die "Smaller" Relationen waren in falscher Richtung. Außerdem müssen TypeParams bei List und AbstractList angefügt werden --- src/test/java/typeinference/UnifyTest.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/test/java/typeinference/UnifyTest.java b/src/test/java/typeinference/UnifyTest.java index c080a8605..41616a4f1 100644 --- a/src/test/java/typeinference/UnifyTest.java +++ b/src/test/java/typeinference/UnifyTest.java @@ -63,25 +63,25 @@ public class UnifyTest { Set constraints = new HashSet<>(); type1 = new ReferenceType("Object"); type2 = new ReferenceType("String"); - constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER)); + constraints.add(new UnifyPair(type2, type1, PairOperator.SMALLER)); type1 = new ReferenceType("Number"); type2 = new ReferenceType("Integer"); - constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER)); + constraints.add(new UnifyPair(type2, type1, PairOperator.SMALLER)); type1 = new ReferenceType("Object"); type2 = new ReferenceType("Number"); - constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER)); + constraints.add(new UnifyPair(type2, type1, PairOperator.SMALLER)); /* type1 = new ReferenceType("AbstractList", new TypeParams(new PlaceholderType("X"))); type2 = new ReferenceType("List", new TypeParams(new PlaceholderType("X"))); constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER)); type1 = new ReferenceType("Object"); type2 = new ReferenceType("AbstractList", new TypeParams(new PlaceholderType("X"))); constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER));*/ - type1 = new ReferenceType("AbstractList"); - type2 = new ReferenceType("List"); - constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER)); + type1 = new ReferenceType("AbstractList", new PlaceholderType("X")); + type2 = new ReferenceType("List", new PlaceholderType("X")); + constraints.add(new UnifyPair(type2, type1, PairOperator.SMALLER)); type1 = new ReferenceType("Object"); - type2 = new ReferenceType("AbstractList"); - constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER)); + type2 = new ReferenceType("AbstractList", new PlaceholderType("X")); + constraints.add(new UnifyPair(type2, type1, PairOperator.SMALLER)); IFiniteClosure finiteClosure = new FiniteClosure(constraints, new NullWriter()); @@ -106,11 +106,11 @@ public class UnifyTest { Set constraints = new HashSet<>(); type1 = new ReferenceType("Object"); - type2 = new ReferenceType("List"); - constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER)); + type2 = new ReferenceType("List", new PlaceholderType("X")); + constraints.add(new UnifyPair(type2, type1, PairOperator.SMALLER)); type1 = new ReferenceType("Object"); type2 = new ReferenceType("Integer"); - constraints.add(new UnifyPair(type1, type2, PairOperator.SMALLER)); + constraints.add(new UnifyPair(type2, type1, PairOperator.SMALLER)); IFiniteClosure finiteClosure = new FiniteClosure(constraints, new NullWriter()); -- 2.34.1