Return type annotation with "where"


Not sure if I’m doing this wrong or perhaps this hasn’t been resolved yet: I can annotate the return type or I can have “where” in the function definition but I don’t know how to have both.

struct TypeA
something(s::TypeA)::Int = 1 # works
somethingor(s::T) where {T} = 1 # works
somethingorother(s::T)::Int where {T} = 1 #does NOT work


(somethingorother(s::T)::Int) where {T} = 1 # does work

Just add parenthesis


Splendid. Thanks!


See also