Skip to content

Inference regression for empty array #20037

Closed
@nalimilan

Description

@nalimilan

DataFrames formula code hits an inference regression with an empty array. This is problematic since ! is now only defined for AbstractArray{Bool} (which might be an issue on its own).

function f()
    x = [1]
    x = x[!(x .== 1)]
    x .== 0
end

function g()
    x = Any[1]
    x = x[!(x .== 1)]
    x .== 0
end

function h()
    x = Any[1]
    x .== 0
end

On Julia 0.5.0:

julia> f()
0-element BitArray{1}

julia> g()
0-element BitArray{1}

julia> h()
1-element BitArray{1}:
 false

On master:

julia> f()
0-element BitArray{1}

julia> g()
0-element Array{Any,1}

julia> h()
1-element BitArray{1}:
 false

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs decisionA decision on this change is neededregressionRegression in behavior compared to a previous version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions