1// errorcheck 2 3// Copyright 2019 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 7package p 8 9import "io" 10 11// Alan's initial report. 12 13type I interface { f(); String() string } 14type J interface { g(); String() string } 15 16type IJ1 = interface { I; J } 17type IJ2 = interface { f(); g(); String() string } 18 19var _ = (*IJ1)(nil) == (*IJ2)(nil) // static assert that IJ1 and IJ2 are identical types 20 21// The canonical example. 22 23type ReadWriteCloser interface { io.ReadCloser; io.WriteCloser } 24 25// Some more cases. 26 27type M interface { m() } 28type M32 interface { m() int32 } 29type M64 interface { m() int64 } 30 31type U1 interface { m() } 32type U2 interface { m(); M } 33type U3 interface { M; m() } 34type U4 interface { M; M; M } 35type U5 interface { U1; U2; U3; U4 } 36 37type U6 interface { m(); m() } // ERROR "duplicate method .*m" 38type U7 interface { M32; m() } // ERROR "duplicate method .*m" 39type U8 interface { m(); M32 } // ERROR "duplicate method .*m" 40type U9 interface { M32; M64 } // ERROR "duplicate method .*m" 41