From f659ff15364ae6eeb7dcca174dfd6f27134bf4b0 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Thu, 11 Nov 2021 23:36:43 +0100 Subject: [PATCH] Only compile one class at a time --- src/main/scala/hb/dhbw/TYPE.scala | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/scala/hb/dhbw/TYPE.scala b/src/main/scala/hb/dhbw/TYPE.scala index 6e40938..541f4be 100644 --- a/src/main/scala/hb/dhbw/TYPE.scala +++ b/src/main/scala/hb/dhbw/TYPE.scala @@ -9,7 +9,7 @@ final case class LessDot(l: Type, r: Type) extends Constraint object TYPE { def generateConstraints(c: List[Class], finiteClosure: FiniteClosure) = { - new TYPEMonad().TYPEClass(c, finiteClosure) + new TYPEMonad().TYPEClass(c.last, c, finiteClosure) } private class GenericTypeReplaceMonad(tpvs: TYPEMonad){ @@ -38,12 +38,11 @@ object TYPE { private class TYPEMonad{ var tpvNum = 0 - def TYPEClass(ast: List[Class], fc: FiniteClosure) = { - - (ast.flatMap(cl => { - val thisType = RefType(cl.name, cl.genericParams.map(it => RefType(it._1.asInstanceOf[GenericType].name, List()))) - cl.methods.flatMap(m => TYPEMethod(m, thisType, ast)) - }), fc) + def TYPEClass(currentClass: Class, ast: List[Class], fc: FiniteClosure) = { + ({ + val thisType = RefType(currentClass.name, currentClass.genericParams.map(it => RefType(it._1.asInstanceOf[GenericType].name, List()))) + currentClass.methods.flatMap(m => TYPEMethod(m, thisType, ast)) + }, fc) } def freshTPV() = {