Skip to content

construct_seeds for types where typeof(one(T)) !=T is broken #651

Description

@longemen3000

as far as i understand, the type of one(T) is not necessarily T (JuliaPhysics/Measurements.jl#134 for example). but construct_seeds uses this:

@generated function single_seed(::Type{Partials{N,V}}, ::Val{i}) where {N,V,i}
ex = Expr(:tuple, [ifelse(i === j, :(one(V)), :(zero(V))) for j in 1:N]...)
return :(Partials($(ex)))
end

Maybe using oneunit there is more correct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions