Skip to content
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

Open
dgryski opened this issue Mar 10, 2015 · 0 comments
Open

Grind doesn't see assignments in select cases #7

dgryski opened this issue Mar 10, 2015 · 0 comments

Comments

@dgryski
Copy link

dgryski commented Mar 10, 2015

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant