Source file test/convert3.go

     1  // errorcheck
     2  
     3  // Copyright 2009 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  // Verify allowed and disallowed conversions.
     8  // Does not compile.
     9  
    10  package main
    11  
    12  // everything here is legal except the ERROR line
    13  
    14  var c chan int
    15  var d1 chan<- int = c
    16  var d2 = (chan<- int)(c)
    17  
    18  var e *[4]int
    19  var f1 []int = e[0:]
    20  var f2 = []int(e[0:])
    21  
    22  var g = []int(nil)
    23  
    24  type H []int
    25  type J []int
    26  
    27  var h H
    28  var j1 J = h // ERROR "compat|illegal|cannot"
    29  var j2 = J(h)
    30  

View as plain text