2011-11-09 02:58:53 -07:00
|
|
|
// errchk $G -e $D/$F.go
|
|
|
|
|
|
|
|
// Copyright 2011 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.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
2012-01-24 05:53:00 -07:00
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
)
|
2011-11-09 02:58:53 -07:00
|
|
|
|
|
|
|
type I interface {
|
2012-01-24 05:53:00 -07:00
|
|
|
M()
|
2011-11-09 02:58:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func main(){
|
2012-01-24 05:53:00 -07:00
|
|
|
var x I
|
|
|
|
switch x.(type) {
|
|
|
|
case string: // ERROR "impossible"
|
|
|
|
println("FAIL")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Issue 2700: if the case type is an interface, nothing is impossible
|
|
|
|
|
|
|
|
var r io.Reader
|
|
|
|
|
|
|
|
_, _ = r.(io.Writer)
|
|
|
|
|
|
|
|
switch r.(type) {
|
|
|
|
case io.Writer:
|
|
|
|
}
|
2011-11-09 02:58:53 -07:00
|
|
|
}
|
2012-01-24 05:53:00 -07:00
|
|
|
|
|
|
|
|