github.com/llvm-mirror/llgo@v0.0.0-20190322182713-bf6f0a60fce1/test/execution/switch/scope.go (about)

     1  // RUN: llgo -o %t %s
     2  // RUN: %t 2>&1 | FileCheck %s
     3  
     4  // CHECK: 1
     5  // CHECK-NEXT: 2
     6  
     7  package main
     8  
     9  func main() {
    10  	// case clauses have their own scope.
    11  	switch {
    12  	case true, false:
    13  		x := 1
    14  		println(x)
    15  		fallthrough
    16  	default:
    17  		x := 2
    18  		println(x)
    19  	}
    20  }