-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from Qqwy/default_overrides
WIP: Default overrides
- Loading branch information
Showing
55 changed files
with
1,082 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"skip_files": [ | ||
"lib/type_check/options/default_overrides/" | ||
], | ||
"terminal_options": { | ||
"file_column_width": 60 | ||
} | ||
} |
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,41 @@ | ||
defmodule TypeCheck.Builtin.PID do | ||
defstruct [] | ||
|
||
use TypeCheck | ||
@type! t :: %__MODULE__{} | ||
@type! problem_tuple :: {t(), :no_match, %{}, any()} | ||
|
||
defimpl TypeCheck.Protocols.ToCheck do | ||
def to_check(s, param) do | ||
quote generated: true, location: :keep do | ||
case unquote(param) do | ||
x when is_pid(x) -> | ||
{:ok, []} | ||
|
||
_ -> | ||
{:error, {unquote(Macro.escape(s)), :no_match, %{}, unquote(param)}} | ||
end | ||
end | ||
end | ||
end | ||
|
||
defimpl TypeCheck.Protocols.Inspect do | ||
def inspect(_, _opts) do | ||
"pid()" | ||
end | ||
end | ||
|
||
if Code.ensure_loaded?(StreamData) do | ||
defimpl TypeCheck.Protocols.ToStreamData do | ||
def to_gen(_s) do | ||
partgen = | ||
StreamData.integer() | ||
|> StreamData.map(&abs/1) | ||
|
||
{partgen, partgen, partgen} | ||
|> StreamData.map(fn {a, b, c} -> IEx.Helpers.pid(a, b, c) end) | ||
|
||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.