# \`@code\_typed (-2 \<= 1 \<= 2)\` fails

**URL:** <https://discourse.julialang.org/t/code-typed-2-1-2-fails/62561>\
**Category:** General Usage\
**Created:** [June 8, 2021, 7:11am UTC](https://discourse.julialang.org/t/code-typed-2-1-2-fails/62561 "2021-06-08T07:11:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuel\_Ainsworth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samuel_ainsworth/32/15644_2.png) [@Samuel\_Ainsworth](https://discourse.julialang.org/u/Samuel_Ainsworth)\
**Post date:** [June 8, 2021, 7:11am UTC](https://discourse.julialang.org/t/code-typed-2-1-2-fails/62561/1 "2021-06-08T07:11:49Z")

</div>

I’m stumped by this:

```julia
julia> -2 <= 1 <= 2
true

julia> @code_typed (-2 <= 1 <= 2)
ERROR: expression is not a function call, or is too complex for @code_typed to analyze; break it down to simpler parts if possible. In some cases, you may want to use Meta.@lower.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] top-level scope
   @ /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/InteractiveUtils/src/macros.jl:222

```

Same thing happens with `@code_llvm`. OTOH `@code_typed (-2 <= 1)` works fine. Why can’t I see what these compile down to?

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [June 8, 2021, 7:26am UTC](https://discourse.julialang.org/t/code-typed-2-1-2-fails/62561/2 "2021-06-08T07:26:11Z")

</div>

The error message gives the right hint. It has to be a function call, or be simple ‘enough’ (`-2 <= 1` is just a single function call).

This works:

```julia
jl> foo() = (-2 <= 1 <= 2)
foo (generic function with 1 method)

jl> @code_typed foo()
CodeInfo(
1 ─ return true
) => Bool

```

but is perhaps not that interesting, it’s just a constant. You can try this instead:

```julia
jl> foo(x) = (-2 <= x <= 2)
foo (generic function with 2 methods)

jl> @code_typed foo(1)
CodeInfo(
1 ─ %1 = Base.sle_int(-2, x)::Bool
└── goto #3 if not %1
2 ─ %3 = Base.sle_int(x, 2)::Bool
└── return %3
3 ─ return false
) => Bool

```

---

<div class="post-metadata">

**Author:** ![Samuel\_Ainsworth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samuel_ainsworth/32/15644_2.png) [@Samuel\_Ainsworth](https://discourse.julialang.org/u/Samuel_Ainsworth)\
**Post date:** [June 8, 2021, 9:45am UTC](https://discourse.julialang.org/t/code-typed-2-1-2-fails/62561/3 "2021-06-08T09:45:18Z")

</div>

I see… The boundary between “simple enough” and “too complex” is vague to me. But thank you!

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [June 8, 2021, 1:01pm UTC](https://discourse.julialang.org/t/code-typed-2-1-2-fails/62561/4 "2021-06-08T13:01:15Z")

</div>

Well, if it’s a single function call, then it’s simple enough. And `-2 <= 1` is a single call to the function `<=` with two input arguments, so it’s `<=(-2, 1)`.

So, if in doubt, just create a function that calls your code.
