anchor.diff:                    fun (S) -> bad_module_error(L, 'module-alias', S) end,
                     St, Aliases).
   
  -check_alias([Mod,Alias], L, St) when is_atom(Mod),
  -                                     is_atom(Alias) ->
  -    As = orddict:store(Alias, Mod, St#lfe_lint.aliases),
  -    St#lfe_lint{aliases=As}.
  +check_alias([Mod,Alias], L, #lfe_lint{aliases=As0}=St0) when is_atom(Mod),
  +                                                             is_atom(Alias) ->
  +    %% Test if we redefine alias or get circular aliases.
  +    St1 = case orddict:is_key(Alias, As0) of
  +              true -> add_error(L, {redefine_module_alias,Alias}, St0);
  +              false -> St0
  +          end,
  +    St2 = case orddict:is_key(Mod, As0) of
  +              true -> add_error(L, {circular_module_alias,Alias}, St1);
  +              false -> St1
  +          end,
  +    As1 = orddict:store(Alias, Mod, As0),       %Add the alias
  +    St2#lfe_lint{aliases=As1};
  +check_alias(_, L, St) ->
  +    bad_module_error(L, 'module-alias', St).
   
   %% check_export_types(Types, Line, State) -> State.
   
  
positive.code:     lfe_io:format1(<<"bad ~w guard form">>, [Form]);
  format_error({bad_pattern,Pat}) ->
      lfe_io:format1(<<"bad ~w pattern">>, [Pat]);
  format_error({unbound_symb,S}) ->
      lfe_io:format1(<<"symbol ~w is unbound">>, [S]);
  format_error({undefined_function,{F,Ar}}) ->
      lfe_io:format1("function ~w/~w undefined", [F,Ar]);
  format_error({multi_var,S}) ->
      lfe_io:format1("variable ~w multiply defined", [S]);
  %% Functions, imports and exports
  format_error({redefine_function,{F,Ar}}) ->
      lfe_io:format1("function ~w/~w already defined", [F,Ar]);
  format_error({bad_fdef,F}) ->
  
negative.code:     %% case is_element(S, Bvs) or lfe_env:is_vbound(S, Env) of
      case ordsets:is_element(S, Bvs) or le_hasv(S, Env) of
          true -> St;
          false -> add_error(L, {unbound_symbol,S}, St)
      end;
  pat_bit_size(_, _, _, _, _, L, St) -> illegal_bitsize_error(L, St).
  
  