-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
of_eltype
does not work for arrays of eltype Any (?)
#47
Comments
The reason behind this is the type of julia> Base.return_types(x->convert(Int, x), (Any,))
1-element Vector{Any}:
Any MappedArrays.jl/src/MappedArrays.jl Line 116 in 9fbda81
I don't know how to propagate the type information to of_eltype(::Type{T}, data::AbstractArray{S}) where {S, T<:Number} = mappedarray(T, y->convert(S, y), data) It's bad because it's not very extensible to other cases. |
Wow, I was not aware that convert is not inferrable. I would have assumed that this should always be trivially inferrable because it has the return type as an input? Also, julia> f = x -> convert(Int, x)
#1 (generic function with 1 method
julia> @code_warntype f(first(Any[1.0]))
Variables
#self#::Core.Const(var"#1#2"())
x::Float64
Body::Int64
1 ─ %1 = Main.convert(Main.Int, x)::Int64
└── return %1 Edit: |
|
The text was updated successfully, but these errors were encountered: