github.com/huandu/go@v0.0.0-20151114150818-04e615e41150/test/fixedbugs/bug388.go (about)

     1  // errorcheck
     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  // Issue 2231
     8  
     9  package main
    10  import "runtime"
    11  
    12  func foo(runtime.UintType, i int) {  // ERROR "cannot declare name runtime.UintType|named/anonymous mix|undefined identifier"
    13  	println(i, runtime.UintType) // GCCGO_ERROR "undefined identifier"
    14  }
    15  
    16  func bar(i int) {
    17  	runtime.UintType := i       // ERROR "cannot declare name runtime.UintType|non-name on left side|undefined identifier"
    18  	println(runtime.UintType)	// GCCGO_ERROR "invalid use of type|undefined identifier"
    19  }
    20  
    21  func baz() {
    22  	main.i := 1	// ERROR "non-name main.i|non-name on left side"
    23  	println(main.i)	// GCCGO_ERROR "no fields or methods"
    24  }
    25  
    26  func qux() {
    27  	var main.i	// ERROR "unexpected [.]|expected type"
    28  	println(main.i)
    29  }
    30  
    31  func corge() {
    32  	var foo.i int  // ERROR "unexpected [.]|expected type"
    33  	println(foo.i)
    34  }
    35  
    36  func main() {
    37  	foo(42,43)
    38  	bar(1969)
    39  }