diff --git a/main/src/ca/uwaterloo/flix/language/dbg/printer/ErasedAstPrinter.scala b/main/src/ca/uwaterloo/flix/language/dbg/printer/ErasedAstPrinter.scala index 1857bcfc84c..2c596b39c63 100644 --- a/main/src/ca/uwaterloo/flix/language/dbg/printer/ErasedAstPrinter.scala +++ b/main/src/ca/uwaterloo/flix/language/dbg/printer/ErasedAstPrinter.scala @@ -68,8 +68,8 @@ object ErasedAstPrinter { case IfThenElse(exp1, exp2, exp3, _, _) => DocAst.Expression.IfThenElse(print(exp1), print(exp2), print(exp3)) case Branch(exp, branches, _, _) => DocAst.Expression.Branch(print(exp), branches.view.mapValues(print).toMap) case JumpTo(sym, _, _) => DocAst.Expression.JumpTo(sym) - case Let(sym, exp1, exp2, tpe, _) => DocAst.Expression.Let(printVarSym(sym), Some(MonoTypePrinter.print(tpe)), print(exp1), print(exp2)) - case LetRec(varSym, _, _, exp1, exp2, tpe, _) => DocAst.Expression.LetRec(printVarSym(varSym), Some(MonoTypePrinter.print(tpe)), print(exp1), print(exp2)) + case Let(sym, exp1, exp2, _, _) => DocAst.Expression.Let(printVarSym(sym), Some(MonoTypePrinter.print(exp1.tpe)), print(exp1), print(exp2)) + case LetRec(varSym, _, _, exp1, exp2, _, _) => DocAst.Expression.LetRec(printVarSym(varSym), Some(MonoTypePrinter.print(exp1.tpe)), print(exp1), print(exp2)) case Scope(sym, exp, _, _) => DocAst.Expression.Scope(printVarSym(sym), print(exp)) case TryCatch(exp, rules, _, _) => DocAst.Expression.TryCatch(print(exp), rules.map { case ErasedAst.CatchRule(sym, clazz, rexp) => (sym, clazz, print(rexp)) diff --git a/main/src/ca/uwaterloo/flix/language/dbg/printer/LiftedAstPrinter.scala b/main/src/ca/uwaterloo/flix/language/dbg/printer/LiftedAstPrinter.scala index f66874b209b..a520851b4a9 100644 --- a/main/src/ca/uwaterloo/flix/language/dbg/printer/LiftedAstPrinter.scala +++ b/main/src/ca/uwaterloo/flix/language/dbg/printer/LiftedAstPrinter.scala @@ -65,8 +65,8 @@ object LiftedAstPrinter { case IfThenElse(exp1, exp2, exp3, _, _, _) => DocAst.Expression.IfThenElse(print(exp1), print(exp2), print(exp3)) case Branch(exp, branches, _, _, _) => DocAst.Expression.Branch(print(exp), branches.view.mapValues(print).toMap) case JumpTo(sym, _, _, _) => DocAst.Expression.JumpTo(sym) - case Let(sym, exp1, exp2, tpe, _, _) => DocAst.Expression.Let(printVarSym(sym), Some(TypePrinter.print(tpe)), print(exp1), print(exp2)) - case LetRec(varSym, _, _, exp1, exp2, tpe, _, _) => DocAst.Expression.LetRec(printVarSym(varSym), Some(TypePrinter.print(tpe)), print(exp1), print(exp2)) + case Let(sym, exp1, exp2, _, _, _) => DocAst.Expression.Let(printVarSym(sym), Some(TypePrinter.print(exp1.tpe)), print(exp1), print(exp2)) + case LetRec(varSym, _, _, exp1, exp2, _, _, _) => DocAst.Expression.LetRec(printVarSym(varSym), Some(TypePrinter.print(exp1.tpe)), print(exp1), print(exp2)) case Region(_, _) => DocAst.Expression.Region case Scope(sym, exp, _, _, _) => DocAst.Expression.Scope(printVarSym(sym), print(exp)) case ScopeExit(exp1, exp2, _, _, _) => DocAst.Expression.ScopeExit(print(exp1), print(exp2)) diff --git a/main/src/ca/uwaterloo/flix/language/dbg/printer/MonoTypedAstPrinter.scala b/main/src/ca/uwaterloo/flix/language/dbg/printer/MonoTypedAstPrinter.scala index 000b736633d..13b1a927ff7 100644 --- a/main/src/ca/uwaterloo/flix/language/dbg/printer/MonoTypedAstPrinter.scala +++ b/main/src/ca/uwaterloo/flix/language/dbg/printer/MonoTypedAstPrinter.scala @@ -64,8 +64,8 @@ object MonoTypedAstPrinter { case IfThenElse(exp1, exp2, exp3, _, _) => DocAst.Expression.IfThenElse(print(exp1), print(exp2), print(exp3)) case Branch(exp, branches, _, _) => DocAst.Expression.Branch(print(exp), branches.view.mapValues(print).toMap) case JumpTo(sym, _, _) => DocAst.Expression.JumpTo(sym) - case Let(sym, exp1, exp2, tpe, _) => DocAst.Expression.Let(printVarSym(sym), Some(MonoTypePrinter.print(tpe)), print(exp1), print(exp2)) - case LetRec(varSym, _, _, exp1, exp2, tpe, _) => DocAst.Expression.LetRec(printVarSym(varSym), Some(MonoTypePrinter.print(tpe)), print(exp1), print(exp2)) + case Let(sym, exp1, exp2, _, _) => DocAst.Expression.Let(printVarSym(sym), Some(MonoTypePrinter.print(exp1.tpe)), print(exp1), print(exp2)) + case LetRec(varSym, _, _, exp1, exp2, _, _) => DocAst.Expression.LetRec(printVarSym(varSym), Some(MonoTypePrinter.print(exp1.tpe)), print(exp1), print(exp2)) case Scope(sym, exp, _, _) => DocAst.Expression.Scope(printVarSym(sym), print(exp)) case TryCatch(exp, rules, _, _) => DocAst.Expression.TryCatch(print(exp), rules.map { case MonoTypedAst.CatchRule(sym, clazz, rexp) => (sym, clazz, print(rexp)) diff --git a/main/src/ca/uwaterloo/flix/language/dbg/printer/ReducedAstPrinter.scala b/main/src/ca/uwaterloo/flix/language/dbg/printer/ReducedAstPrinter.scala index b769bd7465f..a3a44c7112d 100644 --- a/main/src/ca/uwaterloo/flix/language/dbg/printer/ReducedAstPrinter.scala +++ b/main/src/ca/uwaterloo/flix/language/dbg/printer/ReducedAstPrinter.scala @@ -64,8 +64,8 @@ object ReducedAstPrinter { case Expr.IfThenElse(exp1, exp2, exp3, _, _, _) => DocAst.Expression.IfThenElse(print(exp1), print(exp2), print(exp3)) case Expr.Branch(exp, branches, _, _, _) => DocAst.Expression.Branch(print(exp), branches.view.mapValues(print).toMap) case Expr.JumpTo(sym, _, _, _) => DocAst.Expression.JumpTo(sym) - case Expr.Let(sym, exp1, exp2, tpe, _, _) => DocAst.Expression.Let(printVarSym(sym), Some(TypePrinter.print(tpe)), print(exp1), print(exp2)) - case Expr.LetRec(varSym, _, _, exp1, exp2, tpe, _, _) => DocAst.Expression.LetRec(printVarSym(varSym), Some(TypePrinter.print(tpe)), print(exp1), print(exp2)) + case Expr.Let(sym, exp1, exp2, _, _, _) => DocAst.Expression.Let(printVarSym(sym), Some(TypePrinter.print(exp1.tpe)), print(exp1), print(exp2)) + case Expr.LetRec(varSym, _, _, exp1, exp2, _, _, _) => DocAst.Expression.LetRec(printVarSym(varSym), Some(TypePrinter.print(exp1.tpe)), print(exp1), print(exp2)) case Expr.Scope(sym, exp, _, _, _) => DocAst.Expression.Scope(printVarSym(sym), print(exp)) case Expr.TryCatch(exp, rules, _, _, _) => DocAst.Expression.TryCatch(print(exp), rules.map{ case ReducedAst.CatchRule(sym, clazz, exp) => (sym, clazz, print(exp)) diff --git a/main/src/ca/uwaterloo/flix/language/dbg/printer/SimplifiedAstPrinter.scala b/main/src/ca/uwaterloo/flix/language/dbg/printer/SimplifiedAstPrinter.scala index 8c7a75cf873..049e3452e33 100644 --- a/main/src/ca/uwaterloo/flix/language/dbg/printer/SimplifiedAstPrinter.scala +++ b/main/src/ca/uwaterloo/flix/language/dbg/printer/SimplifiedAstPrinter.scala @@ -65,8 +65,8 @@ object SimplifiedAstPrinter { case IfThenElse(exp1, exp2, exp3, _, _, _) => DocAst.Expression.IfThenElse(print(exp1), print(exp2), print(exp3)) case Branch(exp, branches, _, _, _) => DocAst.Expression.Branch(print(exp), branches.view.mapValues(print).toMap) case JumpTo(sym, _, _, _) => DocAst.Expression.JumpTo(sym) - case Let(sym, exp1, exp2, tpe, _, _) => DocAst.Expression.Let(printVarSym(sym), Some(TypePrinter.print(tpe)), print(exp1), print(exp2)) - case LetRec(sym, exp1, exp2, tpe, _, _) => DocAst.Expression.LetRec(printVarSym(sym), Some(TypePrinter.print(tpe)), print(exp1), print(exp2)) + case Let(sym, exp1, exp2, _, _, _) => DocAst.Expression.Let(printVarSym(sym), Some(TypePrinter.print(exp1.tpe)), print(exp1), print(exp2)) + case LetRec(sym, exp1, exp2, _, _, _) => DocAst.Expression.LetRec(printVarSym(sym), Some(TypePrinter.print(exp1.tpe)), print(exp1), print(exp2)) case Region(_, _) => DocAst.Expression.Region case Scope(sym, exp, _, _, _) => DocAst.Expression.Scope(printVarSym(sym), print(exp)) case ScopeExit(exp1, exp2, _, _, _) => DocAst.Expression.ScopeExit(print(exp1), print(exp2)) diff --git a/main/src/ca/uwaterloo/flix/language/dbg/printer/TypePrinter.scala b/main/src/ca/uwaterloo/flix/language/dbg/printer/TypePrinter.scala index 3e83f1069b4..2bea3bc7885 100644 --- a/main/src/ca/uwaterloo/flix/language/dbg/printer/TypePrinter.scala +++ b/main/src/ca/uwaterloo/flix/language/dbg/printer/TypePrinter.scala @@ -30,13 +30,9 @@ object TypePrinter { // try to unpack one arrow type only for the sake of signatures tpe.baseType match { case Type.Cst(TypeConstructor.Arrow(_), _) => - val targs = tpe.typeArguments - if (targs.nonEmpty) { - val args = targs.dropRight(1) - val res = targs.last - DocAst.Type.Arrow(args.map(printHelper), printHelper(res)) - } else - printHelper(tpe) + val args = tpe.arrowArgTypes + val res = tpe.arrowResultType + DocAst.Type.Arrow(args.map(printHelper), printHelper(res)) case _ => printHelper(tpe) } }