File: slogan.erl

package info (click to toggle)
erlang 1%3A27.3.4.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 225,000 kB
  • sloc: erlang: 1,658,966; ansic: 405,769; cpp: 177,850; xml: 82,435; makefile: 15,031; sh: 14,401; lisp: 9,812; java: 8,603; asm: 6,541; perl: 5,836; python: 5,484; sed: 72
file content (73 lines) | stat: -rw-r--r-- 1,437 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
-module(slogan).

-export([main/1,
         bar/0,
         no_slogan/1,
         spec_slogan/1,
         spec_slogan/2,
         no_doc_slogan/1,
         spec_no_doc_slogan/1,
         spec_multiclause_slogan_ignored/1,
         connect/2
        ]).

-doc "
main(Foo)

Returns ok.
".
-spec main(X :: integer()) -> ok.
main(_X) ->
    ok.

-doc "
foo()
Not a slogan since foo =/= bar
".
bar() ->
    ok.

-doc "
Not a slogan

Tests slogans in multi-clause
".
-spec no_slogan(atom()) -> atom();
               (term()) -> ok.
no_slogan(X) when is_atom(X) ->
    X;
no_slogan(_X) ->
    ok.

-spec spec_slogan(Y :: integer()) -> integer() | ok.
-doc "Not a slogan".
spec_slogan(_X) -> ok.

-spec spec_slogan(Y :: integer(), Z :: integer()) -> integer() | ok.
-doc "Not a slogan".
spec_slogan(_X, _Y) -> _X + _Y.

no_doc_slogan(X) -> X.

-spec spec_no_doc_slogan(Y) -> Y.
spec_no_doc_slogan(X) ->
    X.


-spec spec_multiclause_slogan_ignored(Y) -> Y;
                                     (Z) -> Z when Z :: integer().
spec_multiclause_slogan_ignored(X) ->
    X.


-doc(#{equiv => connect/3}).
-doc(#{since => <<"OTP R14B">>}).
-spec connect(TCPSocket, TLSOptions) ->
                     {ok, sslsocket} |
                     {error, reason} |
                     {option_not_a_key_value_tuple, any()} when
      TCPSocket :: socket,
      TLSOptions :: [tls_client_option].

connect(Socket, SslOptions) ->
    {Socket, SslOptions}.