/usr/share/go-1.7/test/fixedbugs/issue6847.go is in golang-1.7-src 1.7.4-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | // compile
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Issue 6847: select clauses involving implicit conversion
// of channels trigger a spurious typechecking error during walk.
package p
type I1 interface {
String()
}
type I2 interface {
String()
}
func F() {
var (
cr <-chan int
cs chan<- int
c chan int
ccr chan (<-chan int)
ccs chan chan<- int
cc chan chan int
ok bool
)
// Send cases.
select {
case ccr <- cr:
case ccr <- c:
}
select {
case ccs <- cs:
case ccs <- c:
}
select {
case ccr <- c:
default:
}
// Receive cases.
select {
case cr = <-cc:
case cs = <-cc:
case c = <-cc:
}
select {
case cr = <-cc:
default:
}
select {
case cr, ok = <-cc:
case cs, ok = <-cc:
case c = <-cc:
}
// Interfaces.
var (
c1 chan I1
c2 chan I2
x1 I1
x2 I2
)
select {
case c1 <- x1:
case c1 <- x2:
case c2 <- x1:
case c2 <- x2:
}
select {
case x1 = <-c1:
case x1 = <-c2:
case x2 = <-c1:
case x2 = <-c2:
}
select {
case x1, ok = <-c1:
case x1, ok = <-c2:
case x2, ok = <-c1:
case x2, ok = <-c2:
}
_ = ok
}
|