Skip to content

conservative constant prop if broadcasting is involved #44330

@antoine-levitt

Description

@antoine-levitt

Here's my best attempt at reproduction (the actual case is https://github.com/JuliaMolSim/DFTK.jl/blob/master/src/fft.jl#L47)

function f(x; isreal=true)
    y = similar(x)
    y .= x
    isreal ? real(y) : y
end
@code_warntype f(randn(ComplexF64, 1))

gives a ::Union{Vector{ComplexF64}, Vector{Float64}}. This is on 1.7 and on master. Removing the y .= x or moving isreal to a Val both fix the issue. y[:] = x[:] also has the inference failure.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions