diff --git a/eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc/Narrow.scala b/eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc/Narrow.scala index 468bba2..42e786b 100644 --- a/eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc/Narrow.scala +++ b/eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc/Narrow.scala @@ -192,7 +192,7 @@ class Narrow(pipelineContext: PipelineContext) { t case BoundedDynamicType(bound) => BoundedDynamicType(withRequiredProp(k, bound)) - case ShapeMap(props) => + case ShapeMap(props) if props.exists(_.key == k) => ShapeMap(props.map { case OptProp(`k`, v) => ReqProp(k, v) diff --git a/eqwalizer/test_projects/eqwater/src/eqwater_maps.erl.check b/eqwalizer/test_projects/eqwater/src/eqwater_maps.erl.check index 85fd06b..749ad5e 100644 --- a/eqwalizer/test_projects/eqwater/src/eqwater_maps.erl.check +++ b/eqwalizer/test_projects/eqwater/src/eqwater_maps.erl.check @@ -72,22 +72,7 @@ map_occ_07_neg(M) -> M. | | M. -type foo() :: #{} | #{required := binary(…… | | | -spec add_optional(foo(), binary()) -> foo…… | -add_optional(Foo = #{required := _R1}, Opt…… ERROR | - Foo#{optional => Optional}; | | ..#{..}. - | | Expression has type: #S{optional := binary()} | #S{optional := binary(), required := binary()} - | | Context expected type: foo() - | | - | | #S{optional := binary()} | #S{optional := binary(), required := binary()} is not compatible with foo() - | | because - | | #S{optional := binary()} | #S{optional := binary(), required := binary()} is not compatible with #S{} | #S{optional => binary(), required := binary()} - | | because - | | #S{optional := binary()} is not compatible with #S{} | #S{optional => binary(), required := binary()} - | | because - | | #S{optional := binary()} is not compatible with #S{} - | | These associations do not match: - | | - | | #S{ - | | + optional := ... - | | } +add_optional(Foo = #{required := _R1}, Opt…… OK | + Foo#{optional => Optional}; | | add_optional(Z, _) -> | | Z. | |