Skip to content
This repository was archived by the owner on Jul 7, 2020. It is now read-only.
This repository was archived by the owner on Jul 7, 2020. It is now read-only.

Grind doesn't see assignments in select cases #7

@dgryski

Description

@dgryski

Here is a trimmed down test case:

package main

import "fmt"

func main() {

    ch := make(chan int)

    var ok bool
    var m int
    select {
    case m, ok = <-ch:
        if ok {
            fmt.Println(m)
        }
    }
}

after grinding becomes

package main

import "fmt"

func main() {
    ch := make(chan int)

    select {
    case m, ok = <-ch:
        var ok bool
        if ok {
            var m int
            fmt.Println(m)
        }
    }
}

which fails to build because the declarations of m and ok now appear after their first use in the select case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions