Skip to content

Commit

Permalink
Add a known problem for Elixir's List.first/1 function
Browse files Browse the repository at this point in the history
  • Loading branch information
xxdavid committed Sep 26, 2023
1 parent ac40504 commit fbfafb2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/known_problems/should_pass/elixir_list_first.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-module(elixir_list_first).

-export([f/0]).

% This is how List.first/1 is defined in Elixir
-spec first([]) -> nil;
([Elem, ...]) -> Elem.
first([]) -> nil;
first([Element | _]) -> Element.

-spec f() -> ok.
f() ->
first(some_list()),
ok.

-spec some_list() -> list().
some_list() -> [anything].

0 comments on commit fbfafb2

Please sign in to comment.