Would it be possible easy to improve the inference here?
julia> immutable Foo{T} end
julia> stagedfunction bar{T}(x::Foo{T})
return :(Foo{$T}())
end
bar (generic function with 1 method)
julia> @code_warntype bar(Foo{(1,2)}())
Variables:
x::Foo{(1,2)}
Body:
begin
return ((top(apply_type))(Foo,(1,2))::Type{_<:Foo{T}})()::Foo{T}
end::Foo{T}
Cc @Keno. This seems like an extension of #9016 (which makes the inference for the normal function equivalent concrete).