Skip to content

GrowableArray warning is too strict #1235

@penelopeysm

Description

@penelopeysm
using DynamicPPL, BangBang

vnt = VarNamedTuple()
vnt = BangBang.setindex!!(vnt, 1.0, @varname(a[1]))
vnt = BangBang.setindex!!(vnt, 2.0, @varname(a[2]))

vnt[@varname(a[1:2])]

#=
┌ Warning: Returning a `Base.Array` with a presumed size based on the indices used to set values; but this may not be the actual shape or size of the actual `AbstractArray` that was inside the DynamicPPL model. You should inspect the returned Array to make sure that it has the shape and type you expect.
└ @ DynamicPPL.VarNamedTuples ~/ppl/dppl/src/varnamedtuple/partial_array.jl:800
2-element Vector{Float64}:
 1.0
 2.0
=#

This is too strict. It should warn on a[:], or a, or a[end], but not a[1:2].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions