TypeVar Problem

abstract type MM{A} end
t = TypeVar(:T)

ff(::Type{T}) where T = T

MM{t} # this returns MM{T}, obviously a DataType
ff(Int) # this returns Int
ff(MM{t}) # ERROR: UndefVarError: T not defined

I see that I can’t construct a type using TypeVar.
How can I get this done? Is there a way to expand a type consisting of a typevar to a full type?

Thanks

TypeVar is an internal type. I’m not quite sure why it was ever exported. In your example MM{t} is an incomplete type because it contains a free typevar. A corresponding free type would be
MM{T} where T for which:

julia> ff(MM{T} where T)
MM
3 Likes