anchor.diff:      %% Set pre-defined exported functions.
       PreExp = [{module_info,0},{module_info,1}],
   
  +    %% Build the set of defined functions and the initial call
  +    %% type map.
  +    Defined = defined_functions(Fs, PreExp),
  +    Ctype = maps:from_list([{K,local} || K <- Defined]),
  +
       %% Build initial expand record.
       St0 = #expand{exports=PreExp,
  -                  defined=PreExp
  +		  ctype=Ctype
                    },
  +
       %% Expand the functions.
  -    {Tfs,St1} = forms(Fs, define_functions(Fs, St0)),
  +    {Tfs,St1} = forms(Fs, St0),
  +
       %% Get the correct list of exported functions.
       Exports = case member(export_all, Opts) of
  -                  true -> gb_sets:to_list(St1#expand.defined);
  +                  true -> Defined;
                     false -> St1#expand.exports
                 end,
  +    St2 = St1#expand{exports=Exports,ctype=undefined},
  +
       %% Generate all functions from stored info.
  -    {Ats,St3} = module_attrs(St1#expand{exports = Exports}),
  +    {Ats,St3} = module_attrs(St2),
       {Mfs,St4} = module_predef_funcs(St3),
       {St4#expand.module, St4#expand.exports, Ats ++ Tfs ++ Mfs,
        Opts}.
  
positive.code: expr({call,Line,{atom,La,N}=Atom,As0}, St0) ->
      {As,St1} = expr_list(As0, St0),
      Ar = length(As),
      case defined(N,Ar,St1) of
  	true ->
  	    {{call,Line,Atom,As},St1};
  	_ ->
  	    case imported(N, Ar, St1) of
  		{yes,Mod} ->
  		    {{call,Line,{remote,La,{atom,La,Mod},Atom},As},St1};
  		no ->
  		    case erl_internal:bif(N, Ar) of
  			true ->
  			    {{call,Line,{remote,La,{atom,La,erlang},Atom},As},St1};
  			false -> %% This should have been handled by erl_lint
  			    {{call,Line,Atom,As},St1}
  		    end
  	    end
      end;
  expr({call,Line,{remote,Lr,M0,F},As0}, St0) ->
      {[M1,F1|As1],St1} = expr_list([M0,F|As0], St0),
  
negative.code: 
  -record(expand, {module=[],                     %Module name
                   exports=[],                    %Exports
                   attributes=[],                 %Attributes
                   callbacks=[],                  %Callbacks
                   optional_callbacks=[] :: [fa()],  %Optional callbacks
                   vcount=0,                      %Variable counter
                   func=[],                       %Current function
                   arity=[],                      %Arity for current function
                   fcount=0,			%Local fun count
  		 ctype				%Call type map
                  }).
  
  %% module(Forms, CompileOptions)
  %%      {ModuleName,Exports,TransformedForms,CompileOptions'}
  %%  Expand the forms in one module.
  %%
  %%  CompileOptions is augmented with options from -compile attributes.
  
  module(Fs0, Opts0) ->
  