Type annotation for one-line parametric methods

#1

Hi,

Why do I get error for f3 while both f1 and f2 are correct? Is there any special syntax for type annotation of one-line parametric methods?

function f1(v::Base.Vector{T})::Core.Bool where {T}
    return true
end

f2(v::Base.Vector{T}) where {T} = true

f3(v::Base.Vector{T})::Core.Bool where {T} = true

Thanks in advance,
Piotr

#2

This needs parentheses:
(f3(v::Base.Vector{T})::Bool) where {T} = true

4 Likes