aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2010-03-02 07:08:31 +0000
committerErlang/OTP <[email protected]>2010-03-02 07:08:31 +0000
commit72fbfd173f2f60bb1b12f826adf41ad9f8fa255e (patch)
tree1ee9982d0164d16187b45f5b6541e8679c366739 /lib
parentbd9f45d47b8997c9752f66342a5c00ec5d43fe63 (diff)
downloadotp-72fbfd173f2f60bb1b12f826adf41ad9f8fa255e.tar.gz
otp-72fbfd173f2f60bb1b12f826adf41ad9f8fa255e.tar.bz2
otp-72fbfd173f2f60bb1b12f826adf41ad9f8fa255e.zip
OTP-8473 stdlib: erl_pp bugfix abstract type 'fun'
The abstract type 'fun' could not be printed. This bug has been fixed.
Diffstat (limited to 'lib')
-rw-r--r--lib/stdlib/src/erl_pp.erl14
-rw-r--r--lib/stdlib/test/erl_pp_SUITE.erl25
2 files changed, 26 insertions, 13 deletions
diff --git a/lib/stdlib/src/erl_pp.erl b/lib/stdlib/src/erl_pp.erl
index b1b5bad294..93c2541e80 100644
--- a/lib/stdlib/src/erl_pp.erl
+++ b/lib/stdlib/src/erl_pp.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(erl_pp).
@@ -161,7 +161,9 @@ ltype({type,_Line,binary,[I1,I2]}) ->
binary_type(I1, I2); % except binary()
ltype({type,_Line,'fun',[]}) ->
leaf("fun()");
-ltype({type,_Line,'fun',_}=FunType) ->
+ltype({type,_,'fun',[{type,_,any},_]}=FunType) ->
+ [fun_type(['fun',$(], FunType),$)];
+ltype({type,_Line,'fun',[{type,_,product,_},_]}=FunType) ->
[fun_type(['fun',$(], FunType),$)];
ltype({type,Line,T,Ts}) ->
simple_type({atom,Line,T}, Ts);
diff --git a/lib/stdlib/test/erl_pp_SUITE.erl b/lib/stdlib/test/erl_pp_SUITE.erl
index 0a119d1e38..a695374908 100644
--- a/lib/stdlib/test/erl_pp_SUITE.erl
+++ b/lib/stdlib/test/erl_pp_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2006-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 2006-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
%%%----------------------------------------------------------------
@@ -45,7 +45,8 @@
hook/1,
neg_indent/1,
tickets/1,
- otp_6321/1, otp_6911/1, otp_6914/1, otp_8150/1, otp_8238/1]).
+ otp_6321/1, otp_6911/1, otp_6914/1, otp_8150/1, otp_8238/1,
+ otp_8473/1]).
%% Internal export.
-export([ehook/6]).
@@ -763,7 +764,7 @@ neg_indent(Config) when is_list(Config) ->
ok.
tickets(suite) ->
- [otp_6321, otp_6911, otp_6914, otp_8150, otp_8238].
+ [otp_6321, otp_6911, otp_6914, otp_8150, otp_8238, otp_8473].
otp_6321(doc) ->
"OTP_6321. Bug fix of exprs().";
@@ -911,6 +912,16 @@ type_examples() ->
"f19 = 3 :: integer()|undefined,"
"f5 = 3 :: undefined|integer()}). ">>}].
+otp_8473(doc) ->
+ "OTP_8473. Bugfix abstract type 'fun'.";
+otp_8473(suite) -> [];
+otp_8473(Config) when is_list(Config) ->
+ Ex = [{ex1,<<"-type 'fun'(A) :: A.\n"
+ "-type funkar() :: 'fun'(fun((integer()) -> atom())).\n">>}],
+ ?line _ = [{N,ok} = {N,pp_forms(B)} ||
+ {N,B} <- Ex],
+ ok.
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
compile(Config, Tests) ->