Skip to content

Commit c80695f

Browse files
committed
Handle BlockLit one level higher
1 parent cf0b7ca commit c80695f

File tree

1 file changed

+6
-6
lines changed
  • effekt/shared/src/main/scala/effekt/core

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,24 @@ type TypeParams = Map[Id, TypeArg.Var]
5151

5252
class MonoContext {
5353
var typingContext: TypeParams = Map()
54-
var functionId: FunctionId = Id("notAValidId")
5554

56-
def extendTypingContext(tparam: Id, index: Int) =
55+
def extendTypingContext(tparam: Id, index: Int, functionId: FunctionId) =
5756
typingContext += (tparam -> TypeArg.Var(functionId, index))
5857
}
5958

6059
def findConstraints(definitions: List[Toplevel])(using MonoContext): Constraints =
6160
definitions flatMap findConstraints
6261

6362
def findConstraints(definition: Toplevel)(using ctx: MonoContext): Constraints = definition match
64-
case Toplevel.Def(id, block) => ctx.functionId = id; findConstraints(block)
63+
case Toplevel.Def(id, BlockLit(tparams, cparams, vparams, bparams, body)) =>
64+
tparams.zipWithIndex.foreach(ctx.extendTypingContext(_, _, id))
65+
findConstraints(body)
66+
case Toplevel.Def(id, block) => ???
6567
case Toplevel.Val(id, tpe, binding) => ???
6668

6769
def findConstraints(block: Block)(using ctx: MonoContext): Constraints = block match
6870
case BlockVar(id, annotatedTpe, annotatedCapt) => ???
69-
case BlockLit(tparams, cparams, vparams, bparams, body) =>
70-
tparams.zipWithIndex.foreach(ctx.extendTypingContext)
71-
findConstraints(body)
71+
case BlockLit(tparams, cparams, vparams, bparams, body) => ???
7272
case Unbox(pure) => ???
7373
case New(impl) => ???
7474

0 commit comments

Comments
 (0)