<p dir="auto">Julia 0.4 gets subtype relation wrong inside a function scope with tuple types:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="immutable FakeMethod
    sig::Type{Tuple}  # no error below if leaving the type declaration off!
end

fmm = methods(sin, (Complex{Float16},))[1]
_sin(::String) = Float64()
tmm = methods(_sin, (String,))[1]
@assert !( tmm.sig&lt;:fmm.sig)

tm = FakeMethod(tmm.sig)
fm = FakeMethod(fmm.sig)
# In global scope all works:
@show tmm.sig, fmm.sig
@show tm.sig, fm.sig
@show tm.sig&lt;:fm.sig # true
@show fm.sig&lt;:tm.sig # true
@show fm.sig==tm.sig  # false
@show fm.sig===tm.sig # false
@assert !( tm.sig&lt;:fm.sig )

function f(tmm, fmm)
    println(&quot;\nInside function:&quot;)
    tm = FakeMethod(tmm.sig)
    fm = FakeMethod(fmm.sig)

    @show tmm.sig, fmm.sig
    @show tm.sig, fm.sig
    @show tm.sig&lt;:fm.sig # true!!!!!!!!!
    @show fm.sig&lt;:tm.sig # true!!!!!!!!!
    @show fm.sig==tm.sig  # false (true before #10380)
    @show fm.sig===tm.sig # false
    @assert !( tm.sig&lt;:fm.sig ) # throws an error here
end
f(tmm,fmm)"><pre class="notranslate">immutable FakeMethod
    sig<span class="pl-k">::</span><span class="pl-c1">Type{Tuple}</span>  <span class="pl-c"><span class="pl-c">#</span> no error below if leaving the type declaration off!</span>
<span class="pl-k">end</span>

fmm <span class="pl-k">=</span> <span class="pl-c1">methods</span>(sin, (Complex{Float16},))[<span class="pl-c1">1</span>]
<span class="pl-en">_sin</span>(<span class="pl-k">::</span><span class="pl-c1">String</span>) <span class="pl-k">=</span> <span class="pl-c1">Float64</span>()
tmm <span class="pl-k">=</span> <span class="pl-c1">methods</span>(_sin, (String,))[<span class="pl-c1">1</span>]
<span class="pl-c1">@assert</span> <span class="pl-k">!</span>( tmm<span class="pl-k">.</span>sig<span class="pl-k">&lt;:</span><span class="pl-c1">fmm.sig</span>)

tm <span class="pl-k">=</span> <span class="pl-c1">FakeMethod</span>(tmm<span class="pl-k">.</span>sig)
fm <span class="pl-k">=</span> <span class="pl-c1">FakeMethod</span>(fmm<span class="pl-k">.</span>sig)
<span class="pl-c"><span class="pl-c">#</span> In global scope all works:</span>
<span class="pl-c1">@show</span> tmm<span class="pl-k">.</span>sig, fmm<span class="pl-k">.</span>sig
<span class="pl-c1">@show</span> tm<span class="pl-k">.</span>sig, fm<span class="pl-k">.</span>sig
<span class="pl-c1">@show</span> tm<span class="pl-k">.</span>sig<span class="pl-k">&lt;:</span><span class="pl-c1">fm.sig</span> <span class="pl-c"><span class="pl-c">#</span> true</span>
<span class="pl-c1">@show</span> fm<span class="pl-k">.</span>sig<span class="pl-k">&lt;:</span><span class="pl-c1">tm.sig</span> <span class="pl-c"><span class="pl-c">#</span> true</span>
<span class="pl-c1">@show</span> fm<span class="pl-k">.</span>sig<span class="pl-k">==</span>tm<span class="pl-k">.</span>sig  <span class="pl-c"><span class="pl-c">#</span> false</span>
<span class="pl-c1">@show</span> fm<span class="pl-k">.</span>sig<span class="pl-k">===</span>tm<span class="pl-k">.</span>sig <span class="pl-c"><span class="pl-c">#</span> false</span>
<span class="pl-c1">@assert</span> <span class="pl-k">!</span>( tm<span class="pl-k">.</span>sig<span class="pl-k">&lt;:</span><span class="pl-c1">fm.sig</span> )

<span class="pl-k">function</span> <span class="pl-en">f</span>(tmm, fmm)
    <span class="pl-c1">println</span>(<span class="pl-s"><span class="pl-pds">"</span><span class="pl-cce">\n</span>Inside function:<span class="pl-pds">"</span></span>)
    tm <span class="pl-k">=</span> <span class="pl-c1">FakeMethod</span>(tmm<span class="pl-k">.</span>sig)
    fm <span class="pl-k">=</span> <span class="pl-c1">FakeMethod</span>(fmm<span class="pl-k">.</span>sig)

    <span class="pl-c1">@show</span> tmm<span class="pl-k">.</span>sig, fmm<span class="pl-k">.</span>sig
    <span class="pl-c1">@show</span> tm<span class="pl-k">.</span>sig, fm<span class="pl-k">.</span>sig
    <span class="pl-c1">@show</span> tm<span class="pl-k">.</span>sig<span class="pl-k">&lt;:</span><span class="pl-c1">fm.sig</span> <span class="pl-c"><span class="pl-c">#</span> true!!!!!!!!!</span>
    <span class="pl-c1">@show</span> fm<span class="pl-k">.</span>sig<span class="pl-k">&lt;:</span><span class="pl-c1">tm.sig</span> <span class="pl-c"><span class="pl-c">#</span> true!!!!!!!!!</span>
    <span class="pl-c1">@show</span> fm<span class="pl-k">.</span>sig<span class="pl-k">==</span>tm<span class="pl-k">.</span>sig  <span class="pl-c"><span class="pl-c">#</span> false (true before #10380)</span>
    <span class="pl-c1">@show</span> fm<span class="pl-k">.</span>sig<span class="pl-k">===</span>tm<span class="pl-k">.</span>sig <span class="pl-c"><span class="pl-c">#</span> false</span>
    <span class="pl-c1">@assert</span> <span class="pl-k">!</span>( tm<span class="pl-k">.</span>sig<span class="pl-k">&lt;:</span><span class="pl-c1">fm.sig</span> ) <span class="pl-c"><span class="pl-c">#</span> throws an error here</span>
<span class="pl-k">end</span>
<span class="pl-c1">f</span>(tmm,fmm)</pre></div>
<p dir="auto">Note that it works fine if the type is declared as:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="immutable FakeMethod
    sig
end"><pre class="notranslate">immutable FakeMethod
    sig
<span class="pl-k">end</span></pre></div>
<p dir="auto">typeassert is sometimes removed incorrectly for arguments of inline functions.</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; function f(::Int)
           return 1
       end
f (generic function with 1 method)

julia&gt; 

julia&gt; function f(::Float64)
           return 2
       end
f (generic function with 2 methods)

julia&gt; 

julia&gt; function g(x)
           a = x &gt; 0 ? 1.0 : 1
           if !isa(a, Int)
               return f(a::Int)
           else
               return f(a::Float64)
           end
       end
g (generic function with 1 method)

julia&gt; 

julia&gt; println(@code_typed g(1))
Any[:($(Expr(:lambda, Any[:x], Any[Any[:a],Any[Any[:x,Int64,0],Any[:a,Any,2]],Any[]], :(begin  # none, line 2:
        unless (top(slt_int))(0,x::Int64)::Bool goto 0
        a = 1.0
        goto 1
        0: 
        a = 1
        1:  # line 3:
        unless (top(box))(Bool,(top(not_int))(isa(a::Union(Int64,Float64),Int)::Bool)) goto 2 # line 4:
        return 1
        goto 3
        2:  # line 6:
        return 2
        3: 
    end::Int64))))]

julia&gt; println(g(1))
1

julia&gt; println(g(-1))
2"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-k">function</span> <span class="pl-en">f</span>(<span class="pl-k">::</span><span class="pl-c1">Int</span>)
           <span class="pl-k">return</span> <span class="pl-c1">1</span>
       <span class="pl-k">end</span>
f (generic <span class="pl-k">function</span> with <span class="pl-c1">1</span> method)

julia<span class="pl-k">&gt;</span> 

julia<span class="pl-k">&gt;</span> <span class="pl-k">function</span> <span class="pl-en">f</span>(<span class="pl-k">::</span><span class="pl-c1">Float64</span>)
           <span class="pl-k">return</span> <span class="pl-c1">2</span>
       <span class="pl-k">end</span>
f (generic <span class="pl-k">function</span> with <span class="pl-c1">2</span> methods)

julia<span class="pl-k">&gt;</span> 

julia<span class="pl-k">&gt;</span> <span class="pl-k">function</span> <span class="pl-en">g</span>(x)
           a <span class="pl-k">=</span> x <span class="pl-k">&gt;</span> <span class="pl-c1">0</span> <span class="pl-k">?</span> <span class="pl-c1">1.0</span> <span class="pl-k">:</span> <span class="pl-c1">1</span>
           <span class="pl-k">if</span> <span class="pl-k">!</span><span class="pl-c1">isa</span>(a, Int)
               <span class="pl-k">return</span> <span class="pl-c1">f</span>(a<span class="pl-k">::</span><span class="pl-c1">Int</span>)
           <span class="pl-k">else</span>
               <span class="pl-k">return</span> <span class="pl-c1">f</span>(a<span class="pl-k">::</span><span class="pl-c1">Float64</span>)
           <span class="pl-k">end</span>
       <span class="pl-k">end</span>
g (generic <span class="pl-k">function</span> with <span class="pl-c1">1</span> method)

julia<span class="pl-k">&gt;</span> 

julia<span class="pl-k">&gt;</span> <span class="pl-c1">println</span>(<span class="pl-c1">@code_typed</span> <span class="pl-c1">g</span>(<span class="pl-c1">1</span>))
Any[:(<span class="pl-k">$</span>(<span class="pl-c1">Expr</span>(<span class="pl-c1">:lambda</span>, Any[<span class="pl-c1">:x</span>], Any[Any[<span class="pl-c1">:a</span>],Any[Any[<span class="pl-c1">:x</span>,Int64,<span class="pl-c1">0</span>],Any[<span class="pl-c1">:a</span>,Any,<span class="pl-c1">2</span>]],Any[]], :(<span class="pl-k">begin</span>  <span class="pl-c"><span class="pl-c">#</span> none, line 2:</span>
        unless (<span class="pl-c1">top</span>(slt_int))(<span class="pl-c1">0</span>,x<span class="pl-k">::</span><span class="pl-c1">Int64</span>)<span class="pl-k">::</span><span class="pl-c1">Bool</span> goto <span class="pl-c1">0</span>
        a <span class="pl-k">=</span> <span class="pl-c1">1.0</span>
        goto <span class="pl-c1">1</span>
        <span class="pl-c1">0</span><span class="pl-k">:</span> 
        a <span class="pl-k">=</span> <span class="pl-c1">1</span>
        <span class="pl-c1">1</span><span class="pl-k">:</span>  <span class="pl-c"><span class="pl-c">#</span> line 3:</span>
        unless (<span class="pl-c1">top</span>(box))(Bool,(<span class="pl-c1">top</span>(not_int))(<span class="pl-c1">isa</span>(a<span class="pl-k">::</span><span class="pl-c1">Union(Int64,Float64)</span>,Int)<span class="pl-k">::</span><span class="pl-c1">Bool</span>)) goto <span class="pl-c1">2</span> <span class="pl-c"><span class="pl-c">#</span> line 4:</span>
        <span class="pl-k">return</span> <span class="pl-c1">1</span>
        goto <span class="pl-c1">3</span>
        <span class="pl-c1">2</span><span class="pl-k">:</span>  <span class="pl-c"><span class="pl-c">#</span> line 6:</span>
        <span class="pl-k">return</span> <span class="pl-c1">2</span>
        <span class="pl-c1">3</span><span class="pl-k">:</span> 
    <span class="pl-k">end</span><span class="pl-k">::</span><span class="pl-c1">Int64</span>))))]

julia<span class="pl-k">&gt;</span> <span class="pl-c1">println</span>(<span class="pl-c1">g</span>(<span class="pl-c1">1</span>))
<span class="pl-c1">1</span>

julia<span class="pl-k">&gt;</span> <span class="pl-c1">println</span>(<span class="pl-c1">g</span>(<span class="pl-k">-</span><span class="pl-c1">1</span>))
<span class="pl-c1">2</span></pre></div>
<p dir="auto">P.S. As recently brought up on the dev list, it would be nice to have a <code class="notranslate">@inbounds</code> equivalent for <code class="notranslate">typeassert</code> to be used (correctly) in this case.</p>