with
type foo
x::Int
foo(x) = x > 0 ? new(x) : new(-x)
end
type bar{T<:Integer}
x::T
end
type baz{T<:Integer}
x::T
baz(x) = x > 0 ? new(x) : new(-x)
end
"foo(-5).x" gives 5, "bar(-5).x" gives -5, but "baz(-5).x" gives a
"MethodError: 'convert' has no method matching..." error.
It seems the relevant section in the manual is this
<http://docs.julialang.org/en/release-0.4/manual/constructors/#parametric-constructors>,
but I only have a single field (as opposed to the examples in the link in
which there are almost always two or more fields), so there should be no
type disagreement or ambiguity here. Is this intended behavior?