Parametric type that can "act" as its parameter type

I’m trying to write a type, let’s call it Hole{T}, which can be assigned to a field of type T in a struct. Is this possible to do? I realize it might be quite weird type-wise, but if my other option is to rewrite all my struct fields to be Union{T, Hole}, this seems cleaner.

Not when T is a concrete type.

I am not sure I understand why you think this. Your use case is precisely what Union is for. Just use a concrete type for both options, eg Union{T,Hole{T}}.

This is the situation: I have an abstract syntax tree, in a grammar I didn’t necessarily write myself. I want to represent partial, typed trees, by replacing expressions in the abstract syntax tree by Holes. Since I didn’t write the AST representation, I would prefer to not modify it directly, but instead keep that definition separate from my partial syntax trees.