~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to lib/typer/src/typer_annotator.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2010-03-09 17:34:57 UTC
  • mfrom: (10.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100309173457-4yd6hlcb2osfhx31
Tags: 1:13.b.4-dfsg-3
Manpages in section 1 are needed even if only arch-dependent packages are
built. So, re-enabled them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
%% -*- erlang-indent-level: 2 -*-
2
2
%%
3
3
%% %CopyrightBegin%
4
 
%% 
5
 
%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
6
 
%% 
 
4
%%
 
5
%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
 
6
%%
7
7
%% The contents of this file are subject to the Erlang Public License,
8
8
%% Version 1.1, (the "License"); you may not use this file except in
9
9
%% compliance with the License. You should have received a copy of the
10
10
%% Erlang Public License along with this software. If not, it can be
11
11
%% retrieved online at http://www.erlang.org/.
12
 
%% 
 
12
%%
13
13
%% Software distributed under the License is distributed on an "AS IS"
14
14
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15
15
%% the License for the specific language governing rights and limitations
16
16
%% under the License.
17
 
%% 
 
17
%%
18
18
%% %CopyrightEnd%
19
19
%%
20
20
%%============================================================================
227
227
      Sig = erl_types:t_fun(Arg, Range),
228
228
      case dialyzer_contracts:check_contract(Contract, Sig) of
229
229
        ok -> {{F, A}, {contract, Contract}};
 
230
        {error, {extra_range, _, _}} ->
 
231
          {{F, A}, {contract, Contract}};
230
232
        {error, invalid_contract} ->
231
233
          CString = dialyzer_contracts:contract_to_string(Contract),
232
234
          SigString = dialyzer_utils:format_sig(Sig, RecMap),
235
237
                          "\t The contract is: " ++ CString ++ "\n" ++
236
238
                          "\t but the inferred signature is: ~s",
237
239
                          [M, F, A, SigString]));
238
 
        {error, Msg} ->
 
240
        {error, Msg} when is_list(Msg) -> % Msg is a string()
239
241
          typer:error(
240
242
            io_lib:format("Error in contract of function ~w:~w/~w: ~s",
241
243
                          [M, F, A, Msg]))