github.com/neugram/ng@v0.0.0-20180309130942-d472ff93d872/eval/testdata/typeswitch8.ng (about)

     1  ok := false
     2  
     3  func f() (int, int) {
     4  	return 42, 66
     5  }
     6  
     7  func g(i, j int) interface{} {
     8  	return i+j
     9  }
    10  
    11  switch x, y := f(); v := g(x, y).(type) {
    12  case int:
    13  	if x != 42 {
    14  		panic("ERROR-1")
    15  	}
    16  	if v != 108 {
    17  		panic("ERROR-2")
    18  	}
    19  	ok = true
    20  default:
    21  	panic("ERROR-3")
    22  }
    23  
    24  if !ok {
    25  	panic("ERROR")
    26  }
    27  
    28  print("OK")