@@ -51,24 +51,24 @@ type TypeParams = Map[Id, TypeArg.Var]
51
51
52
52
class MonoContext {
53
53
var typingContext : TypeParams = Map ()
54
- var functionId : FunctionId = Id (" notAValidId" )
55
54
56
- def extendTypingContext (tparam : Id , index : Int ) =
55
+ def extendTypingContext (tparam : Id , index : Int , functionId : FunctionId ) =
57
56
typingContext += (tparam -> TypeArg .Var (functionId, index))
58
57
}
59
58
60
59
def findConstraints (definitions : List [Toplevel ])(using MonoContext ): Constraints =
61
60
definitions flatMap findConstraints
62
61
63
62
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) => ???
65
67
case Toplevel .Val (id, tpe, binding) => ???
66
68
67
69
def findConstraints (block : Block )(using ctx : MonoContext ): Constraints = block match
68
70
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) => ???
72
72
case Unbox (pure) => ???
73
73
case New (impl) => ???
74
74
0 commit comments