-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
When I want a BroadcastQuasiArray
corresponding to a constant function, I do
julia> x = Inclusion(0.0..1.0)
Inclusion(0.0..1.0)
julia> (x -> 1).(x)
QuasiArrays.BroadcastQuasiArray{Int64,1,var"#319#320",Tuple{Inclusion{Float64,Interval{:closed,:closed,Float64}}}}(var"#319#320"(), (Inclusion(0.0..1.0),))
which rightly has an eltype
of Int
. Likewise, if I explicitly state another type, it also works:
julia> (x -> one(ComplexF64)).(x)
QuasiArrays.BroadcastQuasiArray{Complex{Float64},1,var"#317#318",Tuple{Inclusion{Float64,Interval{:closed,:closed,Float64}}}}(var"#317#318"(), (Inclusion(0.0..1.0),))
However, if the type happens to be stored in a variable, I get Any
back:
julia> T = ComplexF64
Complex{Float64}
julia> (x -> one(T)).(x)
QuasiArrays.BroadcastQuasiArray{Any,1,var"#321#322",Tuple{Inclusion{Float64,Interval{:closed,:closed,Float64}}}}(var"#321#322"(), (Inclusion(0.0..1.0),))
Is this easily fixable, or is there a different syntax I should use to avoid type inference ambiguities?
Metadata
Metadata
Assignees
Labels
No labels