Bug during redefinition of `Base.getproperty` for abstract type

I can reproduce with

abstract type MyType end
function Base.getproperty(x::Type{A}, key::Symbol) where {A<:MyType}
    println(key)
    println(x)
end

[foo() for i in 1:2 for j in 1:2]

I think this code is comitting type piracy, because the user owns MyType but not Type{<:MyType}.

1 Like