modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/bug334.go (about)

     1  // compile
     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 1716
     8  
     9  package main
    10  
    11  type (
    12  	cplx64  complex64
    13  	cplx128 complex128
    14  )
    15  
    16  func (c cplx64) Foo()  {}
    17  func (c cplx128) Foo() {}
    18  
    19  func main() {
    20  	var c64 cplx128
    21  	var c128 cplx64
    22  	c64.Foo()
    23  	c128.Foo()
    24  }
    25  
    26  /*
    27  bug334.go:16: invalid receiver type cplx64
    28  bug334.go:17: invalid receiver type cplx128
    29  bug334.go:22: c64.Foo undefined (type cplx128 has no field or method Foo)
    30  bug334.go:23: c128.Foo undefined (type cplx64 has no field or method Foo)
    31  */