@@ -124,14 +124,13 @@ defmodule Module.Types.Expr do
124124 keys = if fallback == none ( ) , do: keys , else: Enum . map ( pairs , & elem ( & 1 , 0 ) ) ++ keys
125125
126126 # Assert the keys exist
127- fallback =
128- Enum . reduce ( keys , fallback , fn key , acc ->
129- case map_fetch ( map_type , key ) do
130- { _ , value_type } -> union ( value_type , acc )
131- :badkey -> throw ( { :badkey , map_type , key , expr , context } )
132- :badmap -> throw ( { :badmap , map_type , expr , context } )
133- end
134- end )
127+ Enum . each ( keys , fn key ->
128+ case map_fetch ( map_type , key ) do
129+ { _ , _ } -> :ok
130+ :badkey -> throw ( { :badkey , map_type , key , expr , context } )
131+ :badmap -> throw ( { :badmap , map_type , expr , context } )
132+ end
133+ end )
135134
136135 if fallback == none ( ) do
137136 Enum . reduce ( pairs , map_type , fn { key , type } , acc ->
@@ -142,6 +141,8 @@ defmodule Module.Types.Expr do
142141 end )
143142 else
144143 # TODO: Use the fallback type to actually indicate if open or closed.
144+ # The fallback must be unioned with the result of map_values with all
145+ # `keys` deleted.
145146 open_map ( pairs )
146147 end
147148 end )
0 commit comments