Such type computation is currently not performed. A standard workaround looks something like this:
immutable Type2{T2,VTT2} <: AbstractT{T2} x::VTT2 end Type2{T2}(x::Vector{Type1{T2}}) = Type2{T2, typeof(x)}(x)
You can optionally introduce a restriction in the internal constructor if you are really worried about who is breaking the rules behind your back.
source share