aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stdlib')
-rw-r--r--lib/stdlib/src/erl_expand_records.erl14
-rw-r--r--lib/stdlib/src/erl_lint.erl12
2 files changed, 19 insertions, 7 deletions
diff --git a/lib/stdlib/src/erl_expand_records.erl b/lib/stdlib/src/erl_expand_records.erl
index 7fc4cc7887..4741bef6b9 100644
--- a/lib/stdlib/src/erl_expand_records.erl
+++ b/lib/stdlib/src/erl_expand_records.erl
@@ -135,9 +135,9 @@ pattern({tuple,Line,Ps}, St0) ->
pattern({map,Line,Ps}, St0) ->
{TPs,St1} = pattern_list(Ps, St0),
{{map,Line,TPs},St1};
-pattern({map_field,Line,Key,V0}, St0) ->
+pattern({map_field_exact,Line,Key,V0}, St0) ->
{V,St1} = pattern(V0, St0),
- {{map_field,Line,Key,V},St1};
+ {{map_field_exact,Line,Key,V},St1};
%%pattern({struct,Line,Tag,Ps}, St0) ->
%% {TPs,TPsvs,St1} = pattern_list(Ps, St0),
%% {{struct,Line,Tag,TPs},TPsvs,St1};
@@ -313,8 +313,14 @@ expr({map,Line,Es0}, St0) ->
expr({map,Line,Var,Es0}, St0) ->
{Es1,St1} = expr_list(Es0, St0),
{{map,Line,Var,Es1},St1};
-expr({map_field,_Line,_,_}=M, St0) ->
- {M,St0};
+expr({map_field_assoc,Line,K0,V0}, St0) ->
+ {K,St1} = expr(K0, St0),
+ {V,St2} = expr(V0, St1),
+ {{map_field_assoc,Line,K,V},St2};
+expr({map_field_exact,Line,K0,V0}, St0) ->
+ {K,St1} = expr(K0, St0),
+ {V,St2} = expr(V0, St1),
+ {{map_field_exact,Line,K,V},St2};
%%expr({struct,Line,Tag,Es0}, Vs, St0) ->
%% {Es1,Esvs,Esus,St1} = expr_list(Es0, Vs, St0),
%% {{struct,Line,Tag,Es1},Esvs,Esus,St1};
diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl
index b74a3ed924..86ebe82acc 100644
--- a/lib/stdlib/src/erl_lint.erl
+++ b/lib/stdlib/src/erl_lint.erl
@@ -1368,7 +1368,9 @@ pattern({tuple,_Line,Ps}, Vt, Old, Bvt, St) ->
pattern_list(Ps, Vt, Old, Bvt, St);
pattern({map,_Line,Ps}, Vt, Old, Bvt, St) ->
pattern_list(Ps, Vt, Old, Bvt, St);
-pattern({map_field,_Line,_,P}, Vt, Old, Bvt0, St0) ->
+pattern({map_field_assoc,_Line,_,_}=Pat, _, _, _, St) ->
+ {[],[],add_error(element(2, Pat), illegal_pattern, St)};
+pattern({map_field_exact,_Line,_,P}, Vt, Old, Bvt0, St0) ->
{Pvt,Bvt,St1} = pattern(P, Vt, Old, Bvt0, St0),
{Pvt,Bvt,St1};
%%pattern({struct,_Line,_Tag,Ps}, Vt, Old, Bvt, St) ->
@@ -1762,7 +1764,9 @@ gexpr({map,_Line,Es}, Vt, St) ->
gexpr_list(Es, Vt, St);
gexpr({map,_Line,Src,Es}, Vt, St) ->
gexpr_list([Src|Es], Vt, St);
-gexpr({map_field,_Line,K,V}, Vt, St) ->
+gexpr({map_field_assoc,_Line,K,V}, Vt, St) ->
+ gexpr_list([K,V], Vt, St);
+gexpr({map_field_exact,_Line,K,V}, Vt, St) ->
gexpr_list([K,V], Vt, St);
gexpr({record_index,Line,Name,Field}, _Vt, St) ->
check_record(Line, Name, St,
@@ -1985,7 +1989,9 @@ expr({map,_Line,Es}, Vt, St) ->
expr_list(Es, Vt, St);
expr({map,_Line,Src,Es}, Vt, St) ->
expr_list([Src|Es], Vt, St);
-expr({map_field,_Line,K,V}, Vt, St) ->
+expr({map_field_assoc,_Line,K,V}, Vt, St) ->
+ expr_list([K,V], Vt, St);
+expr({map_field_exact,_Line,K,V}, Vt, St) ->
expr_list([K,V], Vt, St);
expr({record_index,Line,Name,Field}, _Vt, St) ->
check_record(Line, Name, St,