Skip to content

Commit 6e75cc3

Browse files
author
Francois Brodeur
authored
Warning and shadowing (#293)
* Fix unused variables * Fix shadowed variables
1 parent 766ba27 commit 6e75cc3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/typechecker.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,7 @@ type_check_fields(Env, TypedRecFields, [{record_field, _, {atom, _, _} = FieldWi
17281728
{VB1, Cs1} = type_check_expr_in(Env, FieldTy, Expr),
17291729
{VB2, Cs2} = type_check_fields(Env, TypedRecFields, Fields, UnAssignedFields),
17301730
{union_var_binds(VB1, VB2, Env#env.tenv), constraints:combine(Cs1,Cs2)};
1731-
type_check_fields(Env, TypedRecFields, [{record_field, _, {var, _, '_'}, Expr} | Fields]
1731+
type_check_fields(Env, TypedRecFields, [{record_field, _, {var, _, '_'}, Expr} | _Fields]
17321732
,UnAssignedFields) ->
17331733
{VB1, Cs1} = type_check_fields(Env, TypedRecFields
17341734
,[ {record_field, erl_anno:new(0)
@@ -2214,7 +2214,7 @@ do_type_check_expr_in(Env, ResTy, {record, Anno, Exp, Name, Fields} = Record) ->
22142214
end
22152215
,Fields)
22162216
),
2217-
RecordTy = type_record(Name, [type_field_type(Name, Type) || ?typed_record_field(Name, Type) <- Rec]),
2217+
RecordTy = type_record(Name, [type_field_type(FieldName, Type) || ?typed_record_field(FieldName, Type) <- Rec]),
22182218
{VarBinds, Cs2} = type_check_expr_in(Env, RecordTy, Exp),
22192219
{union_var_binds([VarBinds|VarBindsList], Env#env.tenv)
22202220
,constraints:combine([Cs1, Cs2|Css])};
@@ -3332,7 +3332,7 @@ refine(OrigTy, Ty, TEnv) ->
33323332

33333333
get_record_fields_types(Name, Anno, TEnv) ->
33343334
RecordFields = get_maybe_remote_record_fields(Name, Anno, TEnv),
3335-
[type_field_type(Name, Type) || ?typed_record_field(Name, Type) <- RecordFields].
3335+
[type_field_type(FieldName, Type) || ?typed_record_field(FieldName, Type) <- RecordFields].
33363336

33373337
expand_record(Name, Anno, TEnv) ->
33383338
type_record(Name, get_record_fields_types(Name, Anno, TEnv)).

src/typelib.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ remove_pos({type, _, Assoc, Tys}) when Assoc == map_field_exact;
117117
remove_pos({remote_type, _, [Mod, Name, Params]}) ->
118118
Params1 = lists:map(fun remove_pos/1, Params),
119119
{remote_type, erl_anno:new(0), [Mod, Name, Params1]};
120-
remove_pos({ann_type, _, [Var, Type]}) ->
120+
remove_pos({ann_type, _, [_Var, Type]}) ->
121121
%% Also remove annotated types one the form Name :: Type
122122
remove_pos(Type);
123123
remove_pos({op, _, Op, Type}) ->

0 commit comments

Comments
 (0)