What is wrong with this function

Normal functions in julia 1.0+ can not have type parameters in that position.
only constructors for objects.
IIRC there was a version of julia 0.x where they could but they worked like where clauses.

You probably intended:

julia> function setBit(i::I, bit::Int64) where {I<:Integer}
           return (i | (1<< (bit-1)))::I
       end
setBit (generic function with 1 method)
1 Like