]> Cypherpunks.ru repositories - gostls13.git/blob - test/typeswitch3.go
gc: static implements check on typeswitches only applies to concrete case types.
[gostls13.git] / test / typeswitch3.go
1 // errchk $G -e $D/$F.go
2
3 // Copyright 2011 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 package main
8
9 import (
10         "io"
11 )
12
13 type I interface {
14         M()
15 }
16
17 func main(){
18         var x I
19         switch x.(type) {
20         case string:    // ERROR "impossible"
21                 println("FAIL")
22         }
23         
24         // Issue 2700: if the case type is an interface, nothing is impossible
25         
26         var r io.Reader
27         
28         _, _ = r.(io.Writer)
29         
30         switch r.(type) {
31         case io.Writer:
32         }
33 }
34
35