# Type constraint in struct definition

I want to do something like the following:

``````abstract type Foo{V, S} end

# Does not work but the idea is that I want to constrain T and
# use whatever U that makes the constraint in the
# parameterization of the super type
struct Bar{T <: Foo{U}} <: Foo{U, Nothing} where U <: Real end
``````

Right now the closest I can get in a way that works is

``````# Here V should be whatever <:Real actually comes out to
struct Bar{T <: Foo{<:Real}, V} <: Foo{V, Nothing} end
``````

but this is not optimal since types like:

``````Bar{Foo{Int64, Int64}, Float64}
``````

would be allowed (I want this to be an error since `Float64` should be `Int64` by the type constraint that I desire.

I understand that I can create an outer constructor

``````Bar(::Type{T}) where T <: Foo{V, S} where {V, S} = Bar{T, V}()
``````

to alleviate that issue, but defining such a constructor is error prone and takes extra effort. Especially since I plan on defining hundreds of such subtypes.