You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defmoduleTwoFerdo@moduledoc""" Provides ways to share cookies """@doc""" Two-fer or 2-fer is short for two for one. One for you and one for me. """@spectwo_fer(name::String.t())::String.t()deftwo_fer(name\\"you")whenis_binary(name)do"One for #{name}, one for me."endend
Expectation: The typespec is considered okay by the analyzer.
Reality: The following recommendation is given:
Make sure that the typespec for two_fer/1 is correct. The function accepts one argument - a string, and returns one argument - also a string.
The types String.t() and binary() are equivalent to analysis tools. Although, for those reading the documentation, String.t() implies it is a UTF-8 encoded binary.
The type string() means a charlist, not an Elixir string.
Elixir discourages the use of the string() type. The string() type refers to Erlang strings, which are known as "charlists" in Elixir. They do not refer to Elixir strings, which are UTF-8 encoded binaries.
The text was updated successfully, but these errors were encountered:
My code:
Expectation: The typespec is considered okay by the analyzer.
Reality: The following recommendation is given:
The text was updated successfully, but these errors were encountered: