Skip to content

Commit

Permalink
Add specs for String.replace_* functions (elixir-lang#4945)
Browse files Browse the repository at this point in the history
  • Loading branch information
whatyouhide authored Jul 5, 2016
1 parent 52a14cc commit 1c4dcb7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/elixir/lib/string.ex
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ defmodule String do
"ola ola world"
"""
@spec replace_leading(t, t, t) :: t
def replace_leading(string, match, replacement)
when is_binary(string) and is_binary(match) and is_binary(replacement) do
prefix_size = byte_size(match)
Expand Down Expand Up @@ -653,6 +654,7 @@ defmodule String do
"hello mundo mundo"
"""
@spec replace_trailing(t, t, t) :: t
def replace_trailing(string, match, replacement)
when is_binary(string) and is_binary(match) and is_binary(replacement) do
suffix_size = byte_size(match)
Expand Down Expand Up @@ -695,6 +697,7 @@ defmodule String do
"ola hello world"
"""
@spec replace_prefix(t, t, t) :: t
def replace_prefix(string, match, replacement)
when is_binary(string) and is_binary(match) and is_binary(replacement) do
prefix_size = byte_size(match)
Expand Down Expand Up @@ -730,6 +733,7 @@ defmodule String do
"hello world mundo"
"""
@spec replace_suffix(t, t, t) :: t
def replace_suffix(string, match, replacement)
when is_binary(string) and is_binary(match) and is_binary(replacement) do
suffix_size = byte_size(match)
Expand Down

0 comments on commit 1c4dcb7

Please sign in to comment.