From 432a91b47d51eee83caf936ba1d1a276dba04e5d Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Thu, 4 Nov 2021 19:06:58 +0100 Subject: [PATCH] Start inserting types (only comment) --- src/main/scala/hb/dhbw/FJTypeinference.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/scala/hb/dhbw/FJTypeinference.scala b/src/main/scala/hb/dhbw/FJTypeinference.scala index b196f23..39ef602 100644 --- a/src/main/scala/hb/dhbw/FJTypeinference.scala +++ b/src/main/scala/hb/dhbw/FJTypeinference.scala @@ -31,7 +31,15 @@ object FJTypeinference { def typeinference(str: String): Either[String, Set[Set[UnifyConstraint]]] = { val ast = Parser.parse(str).map(ASTBuilder.fromParseTree(_)) - val typeResult = ast.map(ast => TYPE.generateConstraints(ast, generateFC(ast))) + val typeResult = ast.map(ast => { + /*ast.foldLeft(List())((cOld, c) => { + val typeResult = TYPE.generateConstraints(ast, generateFC(ast)) + val unifyResult = Unify.unify(convertOrConstraints(typeResult._1), typeResult._2) + //TODO: Insert intersection types + List(c) + }) */ + TYPE.generateConstraints(ast, generateFC(ast)) + }) val unifyResult = typeResult.map(res => Unify.unify(convertOrConstraints(res._1), res._2)) unifyResult }