Editing UnionAll and putting it back together

typ = Tuple{Int,T} where T<:Real
unwtyp = Base.unwrap_unionall(typ) # Tuple{Int,T<:Real}
edited = edit(unwtyp,Real,Float64) # Tuple{Int,T<:Float64}, has free type variables.

I want to put Tuple{Int,T<:Float64} back to the form of Tuple{Int,T} where T<:Float64

how can I do that?

Thanks

Any answers?

your edit function is undefined, but this might work

UnionAll(TypeVar(:T,Float64),edited)

You’re probably looking for the rewrap_unionall function.

1 Like

it doesn’t work because TypeVar(:T) == TypeVar(:T) doesn’t work. Since it is scoped variable at C runtime.
anyhow. I figured it out.
Thanks