I noticed the following seemingly weird error when defining an abstract generic type:
abstract type SomeAbstractType{T} end
func(x::SomeAbstractType{T})::Bool where {T} = error("func is not implemented.")
and getting an error like “ERROR: UndefVarError: T not defined”.
However, if the return type is removed then no error occurs:
abstract type SomeAbstractType{T} end
func(x::SomeAbstractType{T}) where {T} = error("func is not implemented.")
# func (generic function with 1 method)
What’s going on here? (I use Julia 1.5)