Skip to content

Commit

Permalink
maps:put/3 <-> #M{K => V}
Browse files Browse the repository at this point in the history
Summary:
- `maps:put/3` has not been updated during map's rework
- `maps:put(K, V, M)` is now the same as `M#{K => V}`

Reviewed By: VLanvin

Differential Revision: D65497178

fbshipit-source-id: 8d78c69541ae4e1aac64186c674b73329f872d9d
  • Loading branch information
ilya-klyuchnikov authored and facebook-github-bot committed Nov 6, 2024
1 parent d48078e commit 3bafe37
Showing 1 changed file with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,12 @@ class ElabApplyCustom(pipelineContext: PipelineContext) {
(subtype.join(valTy, defaultValTy), env1)
}

case fqn @ RemoteId("maps", "put", 3) =>
val List(key, _, map) = args
key match {
case AtomLit(keyAtom) =>
val List(_, valTy, mapTy) = argTys
val mapCoercedTy = coerce(map, mapTy, anyMapTy)
val resTy = narrow.adjustMapType(mapCoercedTy, AtomLitType(keyAtom), valTy)
(resTy, env1)
case _ =>
val ft = util.getFunType(fqn)
val resTy = elabApply.elabApply(ft, args, argTys, env1)
(resTy, env1)
}
case RemoteId("maps", "put", 3) =>
val List(_, _, map) = args
val List(keyTy, valTy, mapTy) = argTys
val mapCoercedTy = coerce(map, mapTy, anyMapTy)
val mapTy1 = narrow.adjustMapType(mapCoercedTy, keyTy, valTy)
(mapTy1, env1)

case RemoteId("maps", "map", 2) =>
val List(funArg, map) = args
Expand Down

0 comments on commit 3bafe37

Please sign in to comment.