Skip to content

Commit

Permalink
Improve typing of maps:map when the input is a shape
Browse files Browse the repository at this point in the history
Summary:
Given `F :: fun((AnyKey, AnyVal) -> Ret)`:
- Previously, `maps:map(F, #{Ka => Va, Kb => Vb, ...}) -> #{Ka | Kb | ... => Ret}`.
- After this diff, `maps:map(F, #{Ka => Va, Kb => Vb, ...}) -> #{Ka =>  Ret, Kb => Ret, ...}`.

Reviewed By: VLanvin

Differential Revision: D59867075

fbshipit-source-id: 5850c1515afc5ba27ec79d40239262e8021360b6
  • Loading branch information
ruippeixotog authored and facebook-github-bot committed Jul 19, 2024
1 parent db757df commit ebbfc67
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions crates/elp/src/resources/test/eqwalizer_tests/check/custom.pretty
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,19 @@ error: incompatible_types
┌─ check/src/custom.erl:496:5
496 │ maps:map(F, M).
│ ^^^^^^^^^^^^^^ maps:map(F, M).
Expression has type: dict map #D{'a' | 'b' => boolean()}
Context expected type: shape map #S{a => 'a', b => 'b'}
│ ^^^^^^^^^^^^^^
│ │
│ maps:map(F, M).
Expression has type: #S{a := boolean(), b := boolean()}
Context expected type: #S{a => 'a', b => 'b'}

See https://fb.me/eqwalizer_errors#incompatible_types

at shape key 'a':
#S{a := boolean(), b := boolean()} is not compatible with #S{a => 'a', b => 'b'}
because
boolean() is not compatible with 'a'

error: incompatible_types
┌─ check/src/custom.erl:502:17
Expand Down

0 comments on commit ebbfc67

Please sign in to comment.