Skip to content

Commit 4b17a99

Browse files
committed
HOF working, except for when giving a direct reference
1 parent fb9ed48 commit 4b17a99

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

effekt/shared/src/main/scala/effekt/core/ArityRaising.scala

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,26 @@ object ArityRaising extends Phase[CoreTransformed, CoreTransformed] {
9898

9999
val flattened = (vargs zip vparamsTypes).map { case (arg, tpe) => flattenArg(arg, tpe) }
100100
val (allArgs, allTypes, allMatches) = flattened.unzip3
101+
102+
val transformedBargs = bargs.map { barg =>
103+
barg match {
104+
// case direct reference here
105+
// transform to lambda and then do the same as below for blocklit
106+
case BlockVar(id, annotatedTpe, annotatedCapt) =>
107+
println(barg.tpe)
108+
transform(barg)
109+
110+
case BlockLit(btparams, bcparams, bvparams, bbparams, body) =>
111+
// Keep the signature unchanged
112+
// But recursively transform the body
113+
val transformedBody = transform(body)
114+
println(barg.tpe)
115+
BlockLit(btparams, bcparams, bvparams, bbparams, transformedBody)
116+
117+
case _ =>
118+
transform(barg)
119+
}
120+
}
101121

102122
val newCalleTpe: BlockType.Function = BlockType.Function(tparams, cparams, allTypes.flatten, bparams, returnTpe)
103123
val newCallee = BlockVar(id, newCalleTpe, annotatedCapt)

0 commit comments

Comments
 (0)