# Using 'inline\_list\_funcs' with lists:xxx

**URL:** <https://erlangforums.com/t/using-inline-list-funcs-with-lists-xxx/1654>\
**Category:** Questions / Help\
**Tags:** erlang-otp\
**Created:** [July 18, 2022, 3:50am UTC](https://erlangforums.com/t/using-inline-list-funcs-with-lists-xxx/1654 "2022-07-18T03:50:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dominic](https://erlangforums.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@dominic](https://erlangforums.com/u/dominic)\
**Post date:** [July 18, 2022, 3:50am UTC](https://erlangforums.com/t/using-inline-list-funcs-with-lists-xxx/1654/1 "2022-07-18T03:50:08Z")

</div>

with `24.3.4` on `WLS`

```erlang
-module(test).

-compile([nowarn_export_all, export_all]).

run(Values) ->
    lists:all(fun erlang:is_integer/1, Values),
    lists:any(fun erlang:is_integer/1, Values),
    lists:foldl(fun erlang:is_integer/1, Values, Values),
    lists:foldr(fun erlang:is_integer/1, Values, Values),
    lists:mapfoldl(fun erlang:is_integer/1, Values, Values),
    lists:mapfoldr(fun erlang:is_integer/1, Values, Values),
    lists:map(fun erlang:is_integer/1, Values),
    lists:flatmap(fun erlang:is_integer/1, Values),
    lists:filter(fun erlang:is_integer/1, Values),
    lists:foreach(fun erlang:is_integer/1, Values).

```

compile with `inline_list_funcs` will get this warning:

> **erlc +inline\_list\_funcs test.erl**
>
> ```erlang
> test.erl:6:5: Warning: this clause cannot match because a previous clause always matches
> % 6| lists:all(fun erlang:is_integer/1, Values),
> % | ^
> 
> test.erl:7:5: Warning: this clause cannot match because a previous clause always matches
> % 7| lists:any(fun erlang:is_integer/1, Values),
> % | ^
> 
> test.erl:8:5: Warning: this clause cannot match because its guard evaluates to 'false'
> % 8| lists:foldl(fun erlang:is_integer/1, Values, Values),
> % | ^
> 
> test.erl:9:5: Warning: this clause cannot match because its guard evaluates to 'false'
> % 9| lists:foldr(fun erlang:is_integer/1, Values, Values),
> % | ^
> 
> test.erl:10:5: Warning: this clause cannot match because its guard evaluates to 'false'
> % 10| lists:mapfoldl(fun erlang:is_integer/1, Values, Values),
> % | ^
> 
> test.erl:11:5: Warning: this clause cannot match because its guard evaluates to 'false'
> % 11| lists:mapfoldr(fun erlang:is_integer/1, Values, Values),
> % | ^
> 
> test.erl:12:5: Warning: the call to is_integer/1 has no effect
> % 12| lists:map(fun erlang:is_integer/1, Values),
> % | ^ ^
> 
> ```

I’m working with `warnings_as_errors`, this is a disaster for me 😰

---

<div class="post-metadata">

**Author:** ![Maria-12648430](https://erlangforums.com/user_avatar/erlangforums.com/maria-12648430/32/604_2.png) [@Maria-12648430](https://erlangforums.com/u/Maria-12648430)\
**Post date:** [July 18, 2022, 10:01am UTC](https://erlangforums.com/t/using-inline-list-funcs-with-lists-xxx/1654/2 "2022-07-18T10:01:32Z")

</div>

Hm, that _is_ strange, you should [open an issue at OTP](https://github.com/erlang/otp/issues) to report it.

Debugging it is hard, for me at least, as said [here](https://erlangforums.com/t/when-exactly-does-the-erlang-compiler-inline-code/1302/4),

> When the `inline_list_funcs` option is given, the compiler uses hard-coded knowledge of a few of the functions in the `lists` module.

* * *

Anyway, with a little trial and error, I found that it seems to be related to your use of `erlang:is_integer/1` as predicate function. Using functions from other modules than `erlang` or an anonymous function does not result in that warning.

You can work around your problem for now by wrapping `erlang:is_integer/1` in an anonymous function, like

```erlang
lists:all(fun(X) -> is_integer(X) end, Values)

```

---

<div class="post-metadata">

**Author:** ![Maria-12648430](https://erlangforums.com/user_avatar/erlangforums.com/maria-12648430/32/604_2.png) [@Maria-12648430](https://erlangforums.com/u/Maria-12648430)\
**Post date:** [July 18, 2022, 10:06am UTC](https://erlangforums.com/t/using-inline-list-funcs-with-lists-xxx/1654/3 "2022-07-18T10:06:16Z")

</div>

Btw, your topic headline is misleading, boolean expressions have nothing to do with it as far as I can tell. That is, you can remove the `is_list(Values) andalso ` part (maybe stick it in a function guard if you need it), and you will still get that warning.

---

<div class="post-metadata">

**Author:** ![dominic](https://erlangforums.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@dominic](https://erlangforums.com/u/dominic)\
**Post date:** [July 18, 2022, 10:32am UTC](https://erlangforums.com/t/using-inline-list-funcs-with-lists-xxx/1654/4 "2022-07-18T10:32:02Z")

</div>

> [@Maria-12648430](#):
>
> Hm, that _is_ strange, you should [open an issue at OTP](https://github.com/erlang/otp/issues) to report it.

OK, I will do it

> [@Maria-12648430](#):
>
> Btw, your topic headline is misleading,

And edited 🙂

---

<div class="post-metadata">

**Author:** ![Maria-12648430](https://erlangforums.com/user_avatar/erlangforums.com/maria-12648430/32/604_2.png) [@Maria-12648430](https://erlangforums.com/u/Maria-12648430)\
**Post date:** [July 19, 2022, 10:13am UTC](https://erlangforums.com/t/using-inline-list-funcs-with-lists-xxx/1654/5 "2022-07-19T10:13:40Z")

</div>

For later reference:

> <https://github.com/erlang/otp/issues/6158>
>
> \*\*Describe the bug\*\*
> lists:all(fun erlang:is\_integer/1, Values) compile with in…line\_list\_funcs 
> 
> \*\*To Reproduce\*\*
> Warning: this clause cannot match because a previous clause always matches
> 
> \*\*Expected behavior\*\*
> no warning
> 
> \*\*Affected versions\*\*
> with 24.3.4 on WLS
> 
> \*\*Additional context\*\*
> see more in:
> https://erlangforums.com/t/using-inline-list-funcs-with-lists-xxx/1654
