X7ROOT File Manager
Current Path:
/opt/golang/1.19.4/src/cmd/compile/internal/types2/testdata/check
opt
/
golang
/
1.19.4
/
src
/
cmd
/
compile
/
internal
/
types2
/
testdata
/
check
/
📁
..
📄
blank.go
(203 B)
📄
builtins0.go
(23.81 KB)
📄
builtins1.go
(5.46 KB)
📄
chans.go
(1.66 KB)
📄
compliterals.go
(442 B)
📄
const0.go
(9.18 KB)
📄
const1.go
(8.56 KB)
📄
constdecl.go
(3.67 KB)
📄
conversions0.go
(1.71 KB)
📄
conversions1.go
(5.07 KB)
📄
cycles0.go
(2.85 KB)
📄
cycles1.go
(781 B)
📄
cycles2.go
(1.12 KB)
📄
cycles3.go
(675 B)
📄
cycles4.go
(2.03 KB)
📄
cycles5.go
(2.98 KB)
📄
decls0.go
(3.97 KB)
📄
decls1.go
(3.6 KB)
📁
decls2
📄
decls3.go
(4.24 KB)
📄
decls4.go
(3.1 KB)
📄
decls5.go
(363 B)
📄
errors.go
(2.16 KB)
📄
expr0.go
(3.7 KB)
📄
expr1.go
(2.61 KB)
📄
expr2.go
(4.92 KB)
📄
expr3.go
(15.42 KB)
📄
funcinference.go
(2.07 KB)
📄
go1_12.go
(1.07 KB)
📄
go1_13.go
(402 B)
📄
go1_16.go
(343 B)
📄
go1_8.go
(333 B)
📄
gotos.go
(5.77 KB)
📄
importC.go
(1.23 KB)
📁
importdecl0
📁
importdecl1
📄
init0.go
(1.91 KB)
📄
init1.go
(1.46 KB)
📄
init2.go
(3.51 KB)
📁
issue25008
📄
issues0.go
(11.44 KB)
📄
issues1.go
(6.02 KB)
📄
labels.go
(3.25 KB)
📄
linalg.go
(2.24 KB)
📄
literals.go
(2.35 KB)
📄
main0.go
(361 B)
📄
main1.go
(250 B)
📄
map0.go
(2.82 KB)
📄
map1.go
(3.4 KB)
📄
methodsets.go
(3.44 KB)
📄
shifts.go
(12.62 KB)
📄
slices.go
(1.51 KB)
📄
stmt0.go
(18.68 KB)
📄
stmt1.go
(3.31 KB)
📄
typeinference.go
(1.38 KB)
📄
typeinst0.go
(1.62 KB)
📄
typeinst1.go
(5.65 KB)
📄
typeinstcycles.go
(384 B)
📄
typeparams.go
(15.06 KB)
📄
unions.go
(2.15 KB)
📄
vardecl.go
(5.47 KB)
Editing: decls4.go
// Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // type aliases package decls4 type ( T0 [10]int T1 []byte T2 struct { x int } T3 interface{ m() T2 } T4 func(int, T0) chan T2 ) type ( Ai = int A0 = T0 A1 = T1 A2 = T2 A3 = T3 A4 = T4 A10 = [10]int A11 = []byte A12 = struct { x int } A13 = interface{ m() A2 } A14 = func(int, A0) chan A2 ) // check assignment compatibility due to equality of types var ( xi_ int ai Ai = xi_ x0 T0 a0 A0 = x0 x1 T1 a1 A1 = x1 x2 T2 a2 A2 = x2 x3 T3 a3 A3 = x3 x4 T4 a4 A4 = x4 ) // alias receiver types func (Ai /* ERROR "cannot define new methods on non-local type int" */) m1() {} func (T0) m1() {} func (A0) m1 /* ERROR already declared */ () {} func (A0) m2 () {} func (A3 /* ERROR invalid receiver */ ) m1 () {} func (A10 /* ERROR invalid receiver */ ) m1() {} // x0 has methods m1, m2 declared via receiver type names T0 and A0 var _ interface{ m1(); m2() } = x0 // alias receiver types (test case for issue #23042) type T struct{} var ( _ = T.m _ = T{}.m _ interface{m()} = T{} ) var ( _ = T.n _ = T{}.n _ interface{m(); n()} = T{} ) type U = T func (U) m() {} // alias receiver types (long type declaration chains) type ( V0 = V1 V1 = (V2) V2 = ((V3)) V3 = T ) func (V0) m /* ERROR already declared */ () {} func (V1) n() {} // alias receiver types (invalid due to cycles) type ( W0 /* ERROR illegal cycle */ = W1 W1 = (W2) W2 = ((W0)) ) func (W0) m() {} // no error expected (due to above cycle error) func (W1) n() {} // alias receiver types (invalid due to builtin underlying type) type ( B0 = B1 B1 = B2 B2 = int ) func (B0 /* ERROR cannot define new methods on non-local type int */ ) m() {} func (B1 /* ERROR cannot define new methods on non-local type int */ ) n() {} // cycles type ( C2 /* ERROR illegal cycle */ = C2 C3 /* ERROR illegal cycle */ = C4 C4 = C3 C5 struct { f *C6 } C6 = C5 C7 /* ERROR illegal cycle */ struct { f C8 } C8 = C7 ) // embedded fields var ( s0 struct { T0 } s1 struct { A0 } = s0 /* ERROR cannot use */ // embedded field names are different ) // embedding and lookup of fields and methods func _(s struct{A0}) { s.A0 = x0 } type eX struct{xf int} func (eX) xm() type eY = struct{eX} // field/method set of eY includes xf, xm type eZ = *struct{eX} // field/method set of eZ includes xf, xm type eA struct { eX // eX contributes xf, xm to eA } type eA2 struct { *eX // *eX contributes xf, xm to eA } type eB struct { eY // eY contributes xf, xm to eB } type eB2 struct { *eY // *eY contributes xf, xm to eB } type eC struct { eZ // eZ contributes xf, xm to eC } var ( _ = eA{}.xf _ = eA{}.xm _ = eA2{}.xf _ = eA2{}.xm _ = eB{}.xf _ = eB{}.xm _ = eB2{}.xf _ = eB2{}.xm _ = eC{}.xf _ = eC{}.xm ) // ambiguous selectors due to embedding via type aliases type eD struct { eY eZ } var ( _ = eD{}.xf /* ERROR ambiguous selector eD\{\}.xf */ _ = eD{}.xm /* ERROR ambiguous selector eD\{\}.xm */ ) var ( _ interface{ xm() } = eD /* ERROR missing method xm */ {} )
Upload File
Create Folder