github.com/rsc/go@v0.0.0-20150416155037-e040fd465409/src/go/types/testdata/issues.src (about) 1 // Copyright 2014 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package issues 6 7 import "fmt" 8 9 func issue7035() { 10 type T struct{ X int } 11 _ = func() { 12 fmt.Println() // must refer to imported fmt rather than the fmt below 13 } 14 fmt := new(T) 15 _ = fmt.X 16 } 17 18 func issue8066() { 19 const ( 20 // TODO(gri) Enable test below for releases 1.4 and higher 21 // _ = float32(340282356779733661637539395458142568447) 22 _ = float32(340282356779733661637539395458142568448 /* ERROR cannot convert */ ) 23 ) 24 } 25 26 // Check that a missing identifier doesn't lead to a spurious error cascade. 27 func issue8799a() { 28 x, ok := missing /* ERROR undeclared */ () 29 _ = !ok 30 _ = x 31 } 32 33 func issue8799b(x int, ok bool) { 34 x, ok = missing /* ERROR undeclared */ () 35 _ = !ok 36 _ = x 37 } 38 39 func issue9182() { 40 type Point C /* ERROR undeclared */ .Point 41 // no error for composite literal based on unknown type 42 _ = Point{x: 1, y: 2} 43 } 44 45 func f0() (a []int) { return } 46 func f1() (a []int, b int) { return } 47 func f2() (a, b []int) { return } 48 49 func append_([]int, ...int) {} 50 51 func issue9473(a []int, b ...int) { 52 // variadic builtin function 53 _ = append(f0()) 54 _ = append(f0(), f0()...) 55 _ = append(f1()) 56 _ = append(f2 /* ERROR cannot pass argument */ ()) 57 _ = append(f2()... /* ERROR cannot use ... */ ) 58 _ = append(f0(), f1 /* ERROR 2-valued expression */ ()) 59 _ = append(f0(), f2 /* ERROR 2-valued expression */ ()) 60 _ = append(f0(), f1()... /* ERROR cannot use ... */ ) 61 _ = append(f0(), f2()... /* ERROR cannot use ... */ ) 62 63 // variadic user-defined function 64 append_(f0()) 65 append_(f0(), f0()...) 66 append_(f1()) 67 append_(f2 /* ERROR cannot pass argument */ ()) 68 append_(f2()... /* ERROR cannot use ... */ ) 69 append_(f0(), f1 /* ERROR 2-valued expression */ ()) 70 append_(f0(), f2 /* ERROR 2-valued expression */ ()) 71 append_(f0(), f1()... /* ERROR cannot use */ ) 72 append_(f0(), f2()... /* ERROR cannot use */ ) 73 }