<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="63166" data-post-id="63166">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Eiji" data-post="12" data-topic="11064">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/eiji/48/36743_2.png" class="avatar"> Eiji:</div>
<blockquote>
<p>What could I miss?</p>
</blockquote>
</aside>
<p>Everything seems to be correct. So no idea from here. Does it work for other functions just fine?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="63166" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/elixir-v1-6-0-rc-0-released/11064/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-63166" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="63166"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="63167" data-post-id="63167">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="chrismcg" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chrismcg/120/671_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  chrismcg
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="13" data-topic="11064">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>The default in the formatter is to always add parens except for:</p>
<p>variables, such as map in your specs. If we changed it to map(), we would change the AST, which means the code before and after are no longer equivalent - and that’s a no-no for a code formatter<br>
local calls listed in your .formatter.exs under :locals_without_parens. So if you don’t want has_many and friends to have parens, you just need to list them in your .formatter.exs file. See the docs for mix format and Code.format_string!</p>
</blockquote>
</aside>
<p><code>map</code> comes from the Basic Types in <a href="https://hexdocs.pm/elixir/master/typespecs.html#types-and-their-syntax" rel="noopener nofollow ugc">https://hexdocs.pm/elixir/master/typespecs.html#types-and-their-syntax</a> and has a <code>()</code> in the docs there so I’m surprised is isn’t added by the language formatter. (As an aside I don’t get why types are made to look like function calls, including the ones I create myself)</p>
<p>From reading the docs <code>.formatter.exs</code> isn’t going to help with <code>Logger.info</code> is it? (Haven’t tried yet).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="63167" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/elixir-v1-6-0-rc-0-released/11064/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-63167" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="63167"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="63168" data-post-id="63168">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>@[quote=“josevalim, post:14, topic:11064”]<br>
Everything seems to be correct. So no idea from here. Does it work for other functions just fine?<br>
[/quote]<br>
I found a problem. This does not work when:</p>
<ol>
<li>I copy module directly into <code>iex</code> shell and call this function</li>
<li>Module and call to it are in same file (just call function directly after module declaration)</li>
</ol>
<p>Both rules applies to normal guards and <code>defguard</code>. Is it expected?</p>
<p>Firstly I through that I have something broken. <img src="https://forum.elixirforum.com/images/emoji/apple/smiley.png?v=15" title=":smiley:" class="emoji" alt=":smiley:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="63168" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/elixir-v1-6-0-rc-0-released/11064/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-63168" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="63168"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="63169" data-post-id="63169">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="chrismcg" data-post="15" data-topic="11064">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chrismcg/48/671_2.png" class="avatar"> chrismcg:</div>
<blockquote>
<p>From reading the docs .formatter.exs isn’t going to help with Logger.info is it? (Haven’t tried yet).</p>
</blockquote>
</aside>
<p>No, it won’t. Those will always have parens.</p>
<aside class="quote no-group" data-username="Eiji" data-post="16" data-topic="11064">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/eiji/48/36743_2.png" class="avatar"> Eiji:</div>
<blockquote>
<p>Both rules applies to normal guards and defguard. Is it expected?</p>
</blockquote>
</aside>
<p>Yup! We need to locate the .beam file in disk in order to the blaming, which means it won’t be available in IEx nor in the middle of compilation.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="63169" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/elixir-v1-6-0-rc-0-released/11064/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-63169" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="63169"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="63171" data-post-id="63171">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/josevalim" rel="nofollow">@josevalim</a>: Thank you very much!<br>
Last question (related to previous - see “My current version”):<br>
Do you think that <code>defguard</code> could help me short my code?<br>
Here is a old, but full version that uses macros:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Example do
  defmacro is_rgb_integer(integer) do
    quote do
      unquote(integer) in 0..255
    end
  end

  defmacro is_rgb_strict(rgb) do
    quote do
      Example.is_rgb_integer(elem(unquote(rgb), 0)) and
        Example.is_rgb_integer(elem(unquote(rgb), 1)) and
        Example.is_rgb_integer(elem(unquote(rgb), 2))
    end
  end

  defmacro is_css_alpha(alpha) do
    quote do
      unquote(alpha) &gt;= 0 and unquote(alpha) &lt;= 1
    end
  end

  defmacro is_rgba(rgba) do
    quote do
      tuple_size(unquote(rgba)) == 4 and Example.is_rgb_strict(unquote(rgba)) and
        Example.is_css_alpha(elem(unquote(rgba), 3))
    end
  end

  defmacro is_rgb(rgba) do
    quote do
      (tuple_size(unquote(rgba)) == 3 and Example.is_rgb_strict(unquote(rgba))) or
        (tuple_size(unquote(rgba)) == 4 and Example.is_rgb_strict(unquote(rgba)) and
           Example.is_css_alpha(elem(unquote(rgba), 3)))
    end
  end
end
</code></pre>
<p>It would be awesome if it will be possible to somehow declare guards with pattern matching in future - just like in function head.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="63171" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/elixir-v1-6-0-rc-0-released/11064/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-63171" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="63171"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="63173" data-post-id="63173">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Eiji" data-post="18" data-topic="11064">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/eiji/48/36743_2.png" class="avatar"> Eiji:</div>
<blockquote>
<p>Do you think that defguard could help me short my code?</p>
</blockquote>
</aside>
<p>This should work:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Example do
  defguard is_rgb_integer(integer) when integer in 0..255

  defguard is_rgb_strict(rgb)
           when is_rgb_integer(elem(rgb, 0)) and
                  is_rgb_integer(elem(rgb, 1)) and
                  is_rgb_integer(elem(rgb, 2))

  defguard is_css_alpha(alpha) when alpha &gt;= 0 and alpha &lt;= 1
    
  defguard is_rgba(rgba)
           when tuple_size(rgba) == 4 and is_rgb_strict(rgba) and is_css_alpha(elem(rgba, 3))

  defguard is_rgb(rgba)
           when (tuple_size(rgba) == 3 and is_rgb_strict(rgba)) or
                (tuple_size(rgba) == 4 and is_rgb_strict(rgba))
end
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="63173" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/elixir-v1-6-0-rc-0-released/11064/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-63173" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="63173"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #18"></div>
  </section>
</div>
    <div class="postbit" id="63175" data-post-id="63175">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="19" data-topic="11064">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>This should work:</p>
</blockquote>
</aside>
<p>Unfortunately not. <img src="https://forum.elixirforum.com/uploads/default/original/2X/2/21f211d8077d436032f525f99fdc6afc2c0736e2.gif?v=15" title=":icon_sad:" class="emoji emoji-custom" alt=":icon_sad:" loading="lazy" width="20" height="20"></p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex(1)&gt; require Example           
Example
iex(2)&gt; Example.is_rgb({255, 255})
** (CompileError) iex:2: undefined function is_rgb_strict/1
    (stdlib) lists.erl:1354: :lists.mapfoldl/3
    (stdlib) lists.erl:1354: :lists.mapfoldl/3
    (elixir) expanding macro: Kernel.and/2
</code></pre>
<p>I tried it myself similarly too, but I can’t call <code>defguard</code> inside <code>defguard</code>.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="63175" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/elixir-v1-6-0-rc-0-released/11064/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-63175" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="63175"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #19"></div>
  </section>
</div>
    <div class="postbit" id="63206" data-post-id="63206">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Eiji" data-post="20" data-topic="11064">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/eiji/48/36743_2.png" class="avatar"> Eiji:</div>
<blockquote>
<p>I tried it myself similarly too, but I can’t call defguard inside defguard.</p>
</blockquote>
</aside>
<p>Can you please open up a bug report? I am almost sure we have a test case for this, so I need to investigate exactly what is happening here.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="63206" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/elixir-v1-6-0-rc-0-released/11064/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-63206" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="63206"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #20"></div>
  </section>
</div>
    <div class="postbit" id="63210" data-post-id="63210">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/josevalim" rel="nofollow">@josevalim</a>: Done.<br>
For all interested more info in <a href="https://github.com/elixir-lang/elixir/issues/7147" rel="noopener nofollow ugc">#7147: Could not call defguard check inside defguard.</a> issue.</p>
<p><strong>Update</strong>: Bug confirmed and fixed in <a href="https://github.com/elixir-lang/elixir/commit/6aadfba586b22b22550e9d839a3c89d27224579b" rel="noopener nofollow ugc">6aadfba586b22b22550e9d839a3c89d27224579b</a> commit.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="63210" data-batch-url="/posts/batch_likers">
                        4
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/elixir-v1-6-0-rc-0-released/11064/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-63210" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="63210"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #21"></div>
  </section>
</div>
    <div class="postbit" id="63239" data-post-id="63239">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/josevalim" rel="nofollow">@josevalim</a>: Sorry for ping you again, but I don’t understand why I got same warning (I corrected my guards).</p>
<h2><a name="p-63239-full-code-1" class="anchor" href="#p-63239-full-code-1" aria-label="Heading link" rel="nofollow"></a>Full code</h2>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Example do
  defguardp is_rgb_integer(tuple, index) when elem(tuple, index) in 0..255

  defguardp is_rgb_base(rgb)
            when is_rgb_integer(rgb, 0) and is_rgb_integer(rgb, 1) and is_rgb_integer(rgb, 2)

  defguard is_css_alpha(alpha) when alpha &gt;= 0 and alpha &lt;= 1

  defguardp is_rba_css_alhpa(tuple) when tuple |&gt; elem(3) |&gt; is_css_alpha()

  defguard is_rgba(rgba)
           when is_tuple(rgba) and tuple_size(rgba) == 4 and is_rgb_base(rgba) and
                  is_rba_css_alhpa(rgba)

  defguard is_rgb(rgba)
           when is_tuple(rgba) and
                  (tuple_size(rgba) == 3 or (tuple_size(rgba) == 4 and is_rba_css_alhpa(rgba))) and
                  is_rgb_base(rgba)
end
</code></pre>
<p>My changes were to make some guards private and don’t called twice, but I’m getting this: <code>warning: this expression will fail with ArgumentError</code></p>
<h1><a name="p-63239-minimal-example-2" class="anchor" href="#p-63239-minimal-example-2" aria-label="Heading link" rel="nofollow"></a>Minimal example</h1>
<p>I wrote smaller example that generates same error:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Example do
  defguard test_me(rgba)
           when is_tuple(rgba) and
                    ( # comment this
                      tuple_size(rgba) == 4
                      and elem(rgba, 3) == :ok
                    ) # comment this
end
# and in another file:
require Example
Example.test_me({1, 2})
</code></pre>
<p>Now try to comment lines with <code>(</code> and <code>)</code> characters (as in comments) and recompile project. Warning will not appear now.</p>
<p>Is it a bug too?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="63239" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/elixir-v1-6-0-rc-0-released/11064/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-63239" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="63239"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #22"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/11064/load_more?page=3">Load more posts (37 remaining)</a>
</div></template></turbo-stream>