Skip to content

Commit d849fc5

Browse files
author
José Valim
committed
Merge pull request #1289 from alco/typespec-doc-formatting
Fix formatting issues in Typespec's docs
2 parents 18bcef3 + 3d73d1a commit d849fc5

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

lib/elixir/lib/kernel/typespec.ex

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
defmodule Kernel.Typespec do
22
@moduledoc """
3-
Holds macros and functions for working with typespecs.
3+
Provides macros and functions for working with typespecs.
44
55
The attributes `@type`, `@opaque`, `@typep`, `@spec` and
66
`@callback` available in modules are handled by the equivalent
77
macros defined by this module.
88
99
## Defining a type
1010
11-
@type type_name :: type
12-
@typep type_name :: type
13-
@opaque type_name :: type
11+
@type type_name :: type
12+
@typep type_name :: type
13+
@opaque type_name :: type
1414
15-
For more details, see documentation for deftype, deftypep and defopaque in
16-
Kernel.Typespec
15+
For more details, see documentation for `deftype`, `deftypep` and `defopaque`
16+
below.
1717
1818
## Defining a specification
1919
20-
@spec function_name(type, type) :: type
21-
@callback function_name(type, type) :: type
20+
@spec function_name(type, type) :: type
21+
@callback function_name(type, type) :: type
2222
23-
For more details, see documentation for defspec and defcallback in
24-
Kernel.Typespec
23+
For more details, see documentation for `defspec` and `defcallback` below.
2524
2625
## Types
2726
@@ -30,9 +29,10 @@ defmodule Kernel.Typespec do
3029
3130
Most of the built-in types provided in Erlang (for example, `pid()`)
3231
are expressed the same way: `pid()` or simply `pid`. Parametrized types
33-
are also supported: `list(integer())` and so are remote types: `Enum.t`.
32+
are also supported (`list(integer())`) and so are remote types (`Enum.t`).
3433
35-
Certain data type shortcuts ([...], <<>> and {...}) are supported as well.
34+
Certain data type shortcuts (`[...]`, `<<>>` and `{...}`) are supported as
35+
well.
3636
3737
Main differences lie in how bit strings and functions are defined:
3838
@@ -81,7 +81,7 @@ defmodule Kernel.Typespec do
8181

8282
@doc """
8383
Defines a type.
84-
This macro is the one responsible to handle the attribute @type.
84+
This macro is the one responsible for handling the attribute `@type`.
8585
8686
## Examples
8787
@@ -96,7 +96,7 @@ defmodule Kernel.Typespec do
9696

9797
@doc """
9898
Defines an opaque type.
99-
This macro is the one responsible to handle the attribute @opaque.
99+
This macro is the one responsible for handling the attribute `@opaque`.
100100
101101
## Examples
102102
@@ -111,7 +111,7 @@ defmodule Kernel.Typespec do
111111

112112
@doc """
113113
Defines a private type.
114-
This macro is the one responsible to handle the attribute @typep.
114+
This macro is the one responsible for handling the attribute `@typep`.
115115
116116
## Examples
117117
@@ -126,7 +126,7 @@ defmodule Kernel.Typespec do
126126

127127
@doc """
128128
Defines a spec.
129-
This macro is the one responsible to handle the attribute @spec.
129+
This macro is the one responsible for handling the attribute `@spec`.
130130
131131
## Examples
132132
@@ -141,7 +141,7 @@ defmodule Kernel.Typespec do
141141

142142
@doc """
143143
Defines a callback.
144-
This macro is the one responsible to handle the attribute @callback.
144+
This macro is the one responsible for handling the attribute `@callback`.
145145
146146
## Examples
147147
@@ -188,7 +188,7 @@ defmodule Kernel.Typespec do
188188
end
189189

190190
@doc """
191-
Returns true if the current module defines a given type
191+
Returns `true` if the current module defines a given type
192192
(private, opaque or not). This function is only available
193193
for modules being compiled.
194194
"""
@@ -199,7 +199,7 @@ defmodule Kernel.Typespec do
199199
end
200200

201201
@doc """
202-
Returns true if the current module defines a given spec.
202+
Returns `true` if the current module defines a given spec.
203203
This function is only available for modules being compiled.
204204
"""
205205
def defines_spec?(module, name, arity) do
@@ -208,7 +208,7 @@ defmodule Kernel.Typespec do
208208
end
209209

210210
@doc """
211-
Returns true if the current module defines a callback.
211+
Returns `true` if the current module defines a callback.
212212
This function is only available for modules being compiled.
213213
"""
214214
def defines_callback?(module, name, arity) do
@@ -256,13 +256,13 @@ defmodule Kernel.Typespec do
256256
end
257257

258258
@doc """
259-
Returns all types available from the beam.
259+
Returns all types available from the module's beam code.
260260
261261
It is returned as a list of tuples where the first
262262
element is the type (`:typep`, `:type` and `:opaque`).
263263
264-
The module has to have a corresponding beam file
265-
on the file system.
264+
The module has to have a corresponding beam file on the disk which can be
265+
located by the runtime system.
266266
"""
267267
def beam_types(module) do
268268
case abstract_code(module) do
@@ -283,26 +283,26 @@ defmodule Kernel.Typespec do
283283
end
284284

285285
@doc """
286-
Returns all specs available from the beam.
286+
Returns all specs available from the module's beam code.
287287
288288
It is returned as a list of tuples where the first
289289
element is spec name and arity and the second is the spec.
290290
291-
The module has to have a corresponding beam file
292-
on the file system.
291+
The module has to have a corresponding beam file on the disk which can be
292+
located by the runtime system.
293293
"""
294294
def beam_specs(module) do
295295
from_abstract_code(module, :spec)
296296
end
297297

298298
@doc """
299-
Returns all callbacks available from the beam.
299+
Returns all callbacks available from the module's beam code.
300300
301301
It is returned as a list of tuples where the first
302302
element is spec name and arity and the second is the spec.
303303
304-
The module has to have a corresponding beam file
305-
on the file system.
304+
The module has to have a corresponding beam file on the disk which can be
305+
located by the runtime system.
306306
"""
307307
def beam_callbacks(module) do
308308
from_abstract_code(module, :callback)

0 commit comments

Comments
 (0)