-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
245 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
defmodule TypeCheck.DefaultOverrides.Agent do | ||
use TypeCheck | ||
|
||
@type! agent() :: pid() | {atom(), node()} | name() | ||
|
||
@type! name() :: atom() | {:global, term()} | {:via, module(), term()} | ||
|
||
@type! on_start() :: {:ok, pid()} | {:error, {:already_started, pid()} | term()} | ||
|
||
@type! state() :: term() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
defmodule TypeCheck.DefaultOverrides.Application do | ||
use TypeCheck | ||
@type! app() :: atom() | ||
|
||
@type! application_key() :: | ||
:start_phases | ||
| :mod | ||
| :applications | ||
| :optional_applications | ||
| :included_applications | ||
| :registered | ||
| :maxT | ||
| :maxP | ||
| :modules | ||
| :vsn | ||
| :id | ||
| :description | ||
|
||
@type! key() :: atom() | ||
|
||
@type! restart_type() :: :permanent | :transient | :temporary | ||
|
||
@type! start_type() :: :normal | {:takeover, node()} | {:failover, node()} | ||
|
||
@type! state() :: term() | ||
|
||
@type! value() :: term() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
defmodule TypeCheck.DefaultOverrides.Config.Provider do | ||
use TypeCheck | ||
|
||
@type! config() :: keyword() | ||
|
||
@type! config_path() :: {:system, binary(), binary()} | binary() | ||
|
||
@type! state() :: term() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
defmodule TypeCheck.DefaultOverrides.DynamicSupervisor do | ||
use TypeCheck | ||
alias TypeCheck.DefaultOverrides.GenServer | ||
|
||
@type! init_option() :: | ||
{:strategy, strategy()} | ||
| {:max_restarts, non_neg_integer()} | ||
| {:max_seconds, pos_integer()} | ||
| {:max_children, non_neg_integer() | :infinity} | ||
| {:extra_arguments, [term()]} | ||
|
||
@type! on_start_child() :: | ||
{:ok, pid()} | ||
| {:ok, pid(), info :: term()} | ||
| :ignore | ||
| {:error, {:already_started, pid()} | :max_children | term()} | ||
|
||
@type! option() :: GenServer.option() | ||
|
||
@type! strategy() :: :one_for_one | ||
|
||
@type! sup_flags() :: %{ | ||
strategy: strategy(), | ||
intensity: non_neg_integer(), | ||
period: pos_integer(), | ||
max_children: non_neg_integer() | :infinity, | ||
extra_arguments: [term()] | ||
} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
defmodule TypeCheck.DefaultOverrides.GenServer do | ||
use TypeCheck | ||
alias TypeCheck.DefaultOverrides.Process | ||
|
||
# TODO | ||
# @type! debug() :: [:trace | :log | :statistics | {:log_to_file, Path.t()}] | ||
@type! debug() :: [:trace | :log | :statistics | {:log_to_file, any()}] | ||
|
||
@type! from() :: {pid(), tag :: term()} | ||
|
||
@type! name() :: atom() | {:global, term()} | {:via, module(), term()} | ||
|
||
@type! on_start() :: | ||
{:ok, pid()} | :ignore | {:error, {:already_started, pid()} | term()} | ||
|
||
@type! option() :: | ||
{:debug, debug()} | ||
| {:name, name()} | ||
| {:timeout, timeout()} | ||
| {:spawn_opt, [Process.spawn_opt()]} | ||
| {:hibernate_after, timeout()} | ||
|
||
@type! options() :: [option()] | ||
|
||
@type! server() :: pid() | name() | {atom(), node()} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
defmodule TypeCheck.DefaultOverrides.Node do | ||
use TypeCheck | ||
|
||
@type! state() :: :visible | :hidden | :connected | :this | :known | ||
|
||
@type! t() :: node() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
defmodule TypeCheck.DefaultOverrides.Process do | ||
use TypeCheck | ||
|
||
@type! dest() :: | ||
pid() | ||
| port() | ||
| (registered_name :: atom()) | ||
| {registered_name :: atom(), node()} | ||
|
||
@typep! heap_size() :: | ||
non_neg_integer() | ||
| %{size: non_neg_integer(), kill: boolean(), error_logger: boolean()} | ||
|
||
@typep! monitor_option() :: list( | ||
{:alias, :explicit_unalias | :demonitor | :reply_demonitor} | | ||
{:tag, term()} | ||
) | ||
|
||
# @typep! priority_level() :: :low | :normal | :high | :max | ||
|
||
@type! spawn_opt() :: | ||
:link | ||
| :monitor | ||
| {:monitor, monitor_option()} | ||
| {:priority, :low | :normal | :high} | ||
| {:fullsweep_after, non_neg_integer()} | ||
| {:min_heap_size, non_neg_integer()} | ||
| {:min_bin_vheap_size, non_neg_integer()} | ||
| {:max_heap_size, heap_size()} | ||
| {:message_queue_data, :off_heap | :on_heap} | ||
|
||
@type! spawn_opts() :: [spawn_opt()] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
defmodule TypeCheck.DefaultOverrides.Registry do | ||
use TypeCheck | ||
|
||
@type body() :: [term()] | ||
|
||
@type guard() :: atom() | tuple() | ||
|
||
@type guards() :: [guard()] | ||
|
||
@type key() :: term() | ||
|
||
@type keys() :: :unique | :duplicate | ||
|
||
@type match_pattern() :: atom() | term() | ||
|
||
@type meta_key() :: atom() | tuple() | ||
|
||
@type meta_value() :: term() | ||
|
||
@type registry() :: atom() | ||
|
||
@type spec() :: [{match_pattern(), guards(), body()}] | ||
|
||
@type start_option() :: | ||
{:keys, keys()} | ||
| {:name, registry()} | ||
| {:partitions, pos_integer()} | ||
| {:listeners, [atom()]} | ||
| {:meta, [{meta_key(), meta_value()}]} | ||
|
||
@type value() :: term() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
defmodule TypeCheck.DefaultOverrides.Supervisor do | ||
use TypeCheck | ||
|
||
@type! child() :: pid() | :undefined | ||
|
||
@type! child_spec() :: %{ | ||
:id => atom() | term(), | ||
:start => {module(), atom(), [term()]}, | ||
optional(:restart) => :permanent | :transient | :temporary, | ||
optional(:shutdown) => timeout() | :brutal_kill, | ||
optional(:type) => :worker | :supervisor, | ||
optional(:modules) => [module()] | :dynamic | ||
} | ||
|
||
@type! init_option() :: | ||
{:strategy, strategy()} | ||
| {:max_restarts, non_neg_integer()} | ||
| {:max_seconds, pos_integer()} | ||
|
||
@type! name() :: atom() | {:global, term()} | {:via, module(), term()} | ||
|
||
@type! on_start() :: | ||
{:ok, pid()} | ||
| :ignore | ||
| {:error, {:already_started, pid()} | {:shutdown, term()} | term()} | ||
|
||
@type! on_start_child() :: | ||
{:ok, child()} | ||
| {:ok, child(), info :: term()} | ||
| {:error, {:already_started, child()} | :already_present | term()} | ||
|
||
@type! option() :: {:name, name()} | ||
|
||
@type! strategy() :: :one_for_one | :one_for_all | :rest_for_one | ||
|
||
@type! supervisor() :: pid() | name() | {atom(), node()} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
defmodule TypeCheck.DefaultOverrides.Task do | ||
use TypeCheck | ||
|
||
@type! t() :: %Task{owner: pid(), pid: pid() | nil, ref: reference()} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
defmodule TypeCheck.DefaultOverrides.Task.Supervisor do | ||
use TypeCheck | ||
alias TypeCheck.DefaultOverrides.DynamicSupervisor | ||
|
||
@type! option() :: DynamicSupervisor.option() | DynamicSupervisor.init_option() | ||
end |