You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 7, 2019. It is now read-only.
using Traits
@traitdef SomeTrait{X} begin
some_function(X) -> Int64
end
immutable TypeOne
x::Float64
end
immutable TypeTwo
x::Int64
end
typealias FloatOrInt Union{TypeOne,TypeTwo}
some_function(x::FloatOrInt) = 1
Yes, I think this should work but is not implemented at the moment. If a trait is fulfilled for all types of a union then the union should be part of the trait too.
E.g.:
(edited by @mauro3)
I traced this in the source to
hasparameters
, which seems it rejects this type because the union type is not aDataType
.Is there a principled reason for that? Offhand I don't see why this trait shouldn't be satisfied by the example.
Thanks
The text was updated successfully, but these errors were encountered: