Skip to content

Commit

Permalink
Add occurrence typing to maps:fold
Browse files Browse the repository at this point in the history
Summary: As title, use occurrence typing in `maps:fold` elaboration, as when elaborating lambdas.

Reviewed By: ilya-klyuchnikov

Differential Revision: D65657513

fbshipit-source-id: 0278b3fc6130261e25bf63de20a5fcb88ec5e30b
  • Loading branch information
VLanvin authored and facebook-github-bot committed Nov 12, 2024
1 parent bc03372 commit ba473da
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,12 @@ class ElabApplyCustom(pipelineContext: PipelineContext) {
case lambda: Lambda =>
val expFunTy = FunType(Nil, List(keyTy, valTy, accTy), accTy)
val lamEnv = lambda.name.map(name => env.updated(name, expFunTy)).getOrElse(env)
val vTys = lambda.clauses.map(elab.elabClause(_, List(keyTy, valTy, accTy), lamEnv, Set.empty)).map(_._1)
val occEnvs = occurrence.clausesEnvs(lambda.clauses, List(keyTy, valTy, accTy), lamEnv)
val vTys =
lambda.clauses
.lazyZip(occEnvs)
.map((clause, occEnv) => elab.elabClause(clause, List(keyTy, valTy, accTy), occEnv, Set.empty))
.map(_._1)
accTy1 :: vTys
case _ =>
val expFunTy = FunType(Nil, List(keyTy, valTy, accTy), AnyType)
Expand Down

0 comments on commit ba473da

Please sign in to comment.