Skip to content

Commit

Permalink
Infer required keys in return of maps:with when open shape has dynami…
Browse files Browse the repository at this point in the history
…c() keys

Summary: Based on internal discussions, we decided that `#{dynamic() => dynamic()} <: #{a := dynamic()}` should hold. On this diff I'm special casing `maps:with` custom typing to produce required keys when that happens.

Reviewed By: VLanvin

Differential Revision: D66828846

fbshipit-source-id: 6aae2c9dc09004387f9056a0ac71a4f11b672a46
  • Loading branch information
ruippeixotog authored and facebook-github-bot committed Dec 5, 2024
1 parent 36bef4c commit 5451996
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ class ElabApplyCustom(pipelineContext: PipelineContext) {
val props = keysToKeep.flatMap { key =>
mapTy.props.get(key) match {
case Some(vProp) => Some(key -> vProp)
case None if mapTy.kType == DynamicType => Some(key -> Prop(true, mapTy.vType))
case None if subtype.subType(Key.asType(key), mapTy.kType) => Some(key -> Prop(false, mapTy.vType))
case None => None
}
Expand Down

0 comments on commit 5451996

Please sign in to comment.