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

     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 that method redeclarations are caught by the compiler.
     8  // Does not compile.
     9  
    10  package main
    11  
    12  type T struct { }
    13  func (t *T) M(int, string)	// GCCGO_ERROR "previous"
    14  func (t *T) M(int, float64) { }   // ERROR "redeclared|redefinition"
    15  
    16  func f(int, string)	// GCCGO_ERROR "previous"
    17  func f(int, float64) { }  // ERROR "redeclared|redefinition"
    18  
    19  func g(a int, b string)  // GCCGO_ERROR "previous"
    20  func g(a int, c string)  // ERROR "redeclared|redefinition"