Is it intentional that defining getproperty(::Type{MyType}, ...) appears to interfere with REPL display and introspection of the type itself, even when unknown properties are delegated to getfield?
struct V{P} end
function Base.getproperty(T::Type{V{P}}, sym::Symbol) where P
if sym == :foo
return n -> n * P
else
getfield(V{P}, sym)
end
end
V{5}
The type itself appears to be perfectly usable. Assignment, property access, and callable-type behavior all work correctly:
T = V{5};
T.foo(7)
T.name
Interestingly, the issue does not seem to affect the type’s functionality. It only surfaces when the REPL attempts to display the type.
Since the custom property works and unknown properties are forwarded to getfield, I am wondering whether this behavior is intentional or whether it might be a corner case in the REPL display machinery.