8000 Refine tracking of slicing index · Issue #268 · uber-go/nilaway · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Refine tracking of slicing index #268
Open
@sonalmahajan15

Description

@sonalmahajan15

For the below case, NilAway correctly tracks the implication of slicing an empty slice and does not report an error.

var x []int
_ = x[:0]

However, when the slicing index is a non-literal, like below, NilAway currently reports a false positive. Refine tracking of non-literal indices to understand such code patterns and avoid false positives. Update func (r *RootAssertionNode) isZeroSlicing(expr *ast.SliceExpr) bool { ... } method to add the support.

var x []int
_ = x[:min(len(x), 100)] // FP: unassigned variable `x` sliced into

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0