Skip to content

Commit 8bc8b79

Browse files
better env propagation for (fun (...) end)(...)
Summary: for `(fun () -> .... end)()` propagate type environments. Needed for proper type-checking of asserts. --- To do the same `(fun (Param1, ...) -> .... end)(Arg1, ...)` - more care should be taken about bound/unbound vars. - Probably in next diffs... Reviewed By: VLanvin Differential Revision: D77861607 fbshipit-source-id: 52f1647827e16f499a23556f7b21f9305eca78f2
1 parent 185db67 commit 8bc8b79

File tree

1 file changed

+3
-2
lines changed
  • eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc

1 file changed

+3
-2
lines changed

eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc/Elab.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,13 @@ final class Elab(pipelineContext: PipelineContext) {
178178
(DynamicType, env1)
179179
case _ =>
180180
val envs = occurrence.clausesEnvs(l.clauses, argTys, env1)
181-
val (resTys, _) =
181+
val (resTys, resEnvs) =
182182
l.clauses
183183
.lazyZip(envs)
184184
.map((clause, occEnv) => elabClause(clause, argTys, occEnv, Set.empty))
185185
.unzip
186-
(subtype.join(resTys), env1)
186+
val resEnv = if (args.isEmpty) subtype.joinEnvs(resEnvs) else env1
187+
(subtype.join(resTys), resEnv)
187188
}
188189
case DynCall(DynRemoteFun(mod, name), args) =>
189190
val env1 = check.checkExpr(mod, AtomType, env)

0 commit comments

Comments
 (0)