8000 Fix `len` handling · Issue #346 · uber-go/nilaway · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Fix len handling #346
Open
Open
@sonalmahajan15

Description

@sonalmahajan15

Fix len handling.

NilAway understands and supports this case:

func foo(args []string) {
	for i := 0; i < len(args); i++ {
		_ = args[i]
	}
}

func test() {
	foo(nil)
}

But it is not encoded to understand operations on len , like len(x)-1 :

func foo(args []string) {
    for i := 0; i < len(args)-1; i++ {  // `len(args) - 1` is not understood by NilAway
       _ = args[i]  // FP here
    }
}

func test() {
    foo(nil)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0