From 37ae27a521dc99b70fac583829745b63bdfdaef4 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Sat, 16 Apr 2022 15:54:36 +0200 Subject: [PATCH] Fix subElim rule, Fix type insert --- src/main/scala/hb/dhbw/InsertTypes.scala | 2 +- src/main/scala/hb/dhbw/Unify.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/hb/dhbw/InsertTypes.scala b/src/main/scala/hb/dhbw/InsertTypes.scala index 667b58c..bc9b65d 100644 --- a/src/main/scala/hb/dhbw/InsertTypes.scala +++ b/src/main/scala/hb/dhbw/InsertTypes.scala @@ -14,7 +14,7 @@ object InsertTypes { case UnifyTV(n) => { val to = solvedCons.find(_.left == x).get to match { - case UnifyEqualsDot(UnifyTV(_), UnifyTV(x)) => this.sigma(UnifyTV(x)) + case UnifyEqualsDot(UnifyTV(_), UnifyTV(x)) => GenericType(x) case UnifyEqualsDot(UnifyTV(_), UnifyRefType(n, ps)) => RefType(n, ps.map(this.sigma(_))) case UnifyLessDot(UnifyTV(x), UnifyRefType(n, ps)) => GenericType(x) } diff --git a/src/main/scala/hb/dhbw/Unify.scala b/src/main/scala/hb/dhbw/Unify.scala index 9796afd..85be72d 100644 --- a/src/main/scala/hb/dhbw/Unify.scala +++ b/src/main/scala/hb/dhbw/Unify.scala @@ -51,7 +51,7 @@ object Unify { case UnifyLessDot(UnifyTV(a), UnifyTV(b)) => true case _ => false }).map(it => { - subst(it.left.asInstanceOf[UnifyTV], it.right, ret) ++ Set(UnifyEqualsDot(it.right, it.left)) + subst(it.left.asInstanceOf[UnifyTV], it.right, ret.filter(it != _)) ++ Set(UnifyEqualsDot(it.left, it.right), UnifyEqualsDot(it.right, it.right)) }) }