Single line function with output type annotation?

function f(x::A{T}, y)::A{T} where {T}
    xxxx
end

is valid, but

f(x::A{T}, y)::A{T} where {T} = xxxx

is invalid as long as there’s a return type annotation (::A{T}). what’s the correct syntax? thanks.

Add some parenthesis:

(f(x::A{T}, y)::A{T}) where {T} = T
3 Likes