@@ -33,6 +33,7 @@ object ArityRaising extends Phase[CoreTransformed, CoreTransformed] {
3333 DC .findData(name) match {
3434 case Some (Data (_, List (), List (Constructor (test, List (), List (Field (x, tpe1), Field (y, tpe2)))))) =>
3535 println(test)
36+ // new names
3637 val vparams = List (ValueParam (x, tpe1), ValueParam (y, tpe2))
3738 val transformedBody = Let (param, ValueType .Data (name, targs),
3839 Make (ValueType .Data (name, targs), test, List (), List (ValueVar (x, tpe1), ValueVar (y, tpe2))), transform(body))
@@ -84,9 +85,10 @@ object ArityRaising extends Phase[CoreTransformed, CoreTransformed] {
8485 println(annotatedCapt)
8586 DC .findData(name) match {
8687 case Some (Data (_, List (), List (Constructor (test, List (), List (Field (x, tpe1), Field (y, tpe2)))))) =>
87- val transformedVargs = List (ValueVar (x, tpe1), ValueVar (y, tpe2))
88+ val xfresh = Id (x.name)
89+ val transformedVargs = List (ValueVar (xfresh, tpe1), ValueVar (y, tpe2))
8890 val res = Stmt .App (BlockVar (id, BlockType .Function (List (), List (), List (tpe1, tpe2), List (), returnTpe), annotatedCapt), targs, transformedVargs, bargs)
89- val latermatch : BlockLit = Block .BlockLit (List (), List (), List (ValueParam (x ,tpe1), ValueParam (y, tpe2)), List (), res)
91+ val latermatch : BlockLit = Block .BlockLit (List (), List (), List (ValueParam (xfresh ,tpe1), ValueParam (y, tpe2)), List (), res)
9092 val newMatch = Stmt .Match (vargs.head, List ((test, latermatch)), None )
9193 println(" res $$$$###" )
9294 println(stmt)
0 commit comments