Start inserting types (only comment)

This commit is contained in:
JanUlrich 2021-11-04 19:06:58 +01:00
parent ab72a69124
commit 432a91b47d

View File

@ -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
}