aboutsummaryrefslogtreecommitdiffstats
path: root/lib/typer
diff options
context:
space:
mode:
authorTomas Abrahamsson <[email protected]>2011-09-15 19:38:23 +0200
committerHenrik Nord <[email protected]>2011-09-16 11:09:05 +0200
commit9c132d619bb3b88201019a39d064f2852a067fb0 (patch)
treeaab53bc942d75894ac1fd1b9ff593cbebbcdb81a /lib/typer
parent68c96ca855821adb42a25ced5b69446ae7ccc635 (diff)
downloadotp-9c132d619bb3b88201019a39d064f2852a067fb0.tar.gz
otp-9c132d619bb3b88201019a39d064f2852a067fb0.tar.bz2
otp-9c132d619bb3b88201019a39d064f2852a067fb0.zip
Quote atoms if necessary in types
Atoms in some occurrences were not correctly quoted when formatted to strings, for instance by the typer program. Example: -module(tb). -export(['UPPERCASE-FUNCTION-NAME'/0, f1/0, f2/0, f3/0]). -record('UPPERCASE-RECORD-NAME', {x}). -record(r2, {'UPPERCASE-FIELD-NAME'}). -type 'UPPERCASE-TYPE-NAME'() :: integer(). 'UPPERCASE-FUNCTION-NAME'() -> ok. f1() -> #'UPPERCASE-RECORD-NAME'{x=1}. f2() -> #r2{'UPPERCASE-FIELD-NAME'=1}. -spec f3() -> 'UPPERCASE-TYPE-NAME'(). f3() -> 1. Given the program above, the output from typer --plt some.plt tb.erl resulted in the following specs being printed: -spec UPPERCASE-FUNCTION-NAME() -> 'ok'. -spec f1() -> #UPPERCASE-RECORD-NAME{x::1}. -spec f2() -> #r2{UPPERCASE-FIELD-NAME::1}. -spec f3() -> UPPERCASE-TYPE-NAME(). This commit changes the output to become the following: -spec 'UPPERCASE-FUNCTION-NAME'() -> 'ok'. -spec f1() -> #'UPPERCASE-RECORD-NAME'{x::1}. -spec f2() -> #r2{'UPPERCASE-FIELD-NAME'::1}. -spec f3() -> 'UPPERCASE-TYPE-NAME'().
Diffstat (limited to 'lib/typer')
-rw-r--r--lib/typer/src/typer.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/typer/src/typer.erl b/lib/typer/src/typer.erl
index e40c4f39cd..fd906c8c46 100644
--- a/lib/typer/src/typer.erl
+++ b/lib/typer/src/typer.erl
@@ -539,7 +539,7 @@ get_type_string(F, A, Info, Mode) ->
case {Mode, Type} of
{file, {contract, _}} -> "";
_ ->
- Prefix = lists:concat(["-spec ", F]),
+ Prefix = lists:concat(["-spec ", erl_types:atom_to_string(F)]),
lists:concat([Prefix, TypeStr, "."])
end;
true ->