Inspect inferred types and generated codes for inner functions

Yes, it should. The example above is already a closure (inner closes over a), and adding modules into the mix does change much:

julia> module Foo
           function foo(a)
               inner() = rand() > a ? a : false  # a type-unstable inner function
               global TEST_INNER = inner
       
               inner()
           end
       end
Main.Foo

julia> Foo.foo(2)
false

julia> @code_warntype Foo.TEST_INNER()
MethodInstance for (::Main.Foo.var"#inner#1"{Int64})()
  from (::Main.Foo.var"#inner#1")() in Main.Foo at REPL[1]:4
Arguments
  #self#::Main.Foo.var"#inner#1"{Int64}
Body::Union{Bool, Int64}
1 ─ %1 = Main.Foo.rand()::Float64
│   %2 = Core.getfield(#self#, :a)::Int64
│   %3 = (%1 > %2)::Bool
└──      goto #3 if not %3
2 ─ %5 = Core.getfield(#self#, :a)::Int64
└──      return %5
3 ─      return false