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: decls1.go
// Copyright 2012 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. // variable declarations package decls1 import ( "math" ) // Global variables without initialization var ( a, b bool c byte d uint8 r rune i int j, k, l int x, y float32 xx, yy float64 u, v complex64 uu, vv complex128 s, t string array []byte iface interface{} blank _ /* ERROR "cannot use _" */ ) // Global variables with initialization var ( s1 = i + j s2 = i /* ERROR "mismatched types" */ + x s3 = c + d s4 = s + t s5 = s /* ERROR "invalid operation" */ / t s6 = array[t1] s7 = array[x /* ERROR "integer" */] s8 = &a s10 = &42 /* ERROR "cannot take address" */ s11 = &v s12 = -(u + *t11) / *&v s13 = a /* ERROR "shifted operand" */ << d s14 = i << j s18 = math.Pi * 10.0 s19 = s1 /* ERROR "cannot call" */ () s20 = f0 /* ERROR "no value" */ () s21 = f6(1, s1, i) s22 = f6(1, s1, uu /* ERROR "cannot use .* in argument" */ ) t1 int = i + j t2 int = i /* ERROR "mismatched types" */ + x t3 int = c /* ERROR "cannot use .* variable declaration" */ + d t4 string = s + t t5 string = s /* ERROR "invalid operation" */ / t t6 byte = array[t1] t7 byte = array[x /* ERROR "must be integer" */] t8 *int = & /* ERROR "cannot use .* variable declaration" */ a t10 *int = &42 /* ERROR "cannot take address" */ t11 *complex64 = &v t12 complex64 = -(u + *t11) / *&v t13 int = a /* ERROR "shifted operand" */ << d t14 int = i << j t15 math /* ERROR "not in selector" */ t16 math.xxx /* ERROR "not declared" */ t17 math /* ERROR "not a type" */ .Pi t18 float64 = math.Pi * 10.0 t19 int = t1 /* ERROR "cannot call" */ () t20 int = f0 /* ERROR "no value" */ () t21 int = a /* ERROR "cannot use .* variable declaration" */ ) // Various more complex expressions var ( u1 = x /* ERROR "not an interface" */ .(int) u2 = iface.([]int) u3 = iface.(a /* ERROR "not a type" */ ) u4, ok = iface.(int) u5, ok2, ok3 = iface /* ERROR "cannot initialize" */ .(int) ) // Constant expression initializations var ( v1 = 1 /* ERROR "mismatched types untyped int and untyped string" */ + "foo" v2 = c + 255 v3 = c + 256 /* ERROR "overflows" */ v4 = r + 2147483647 v5 = r + 2147483648 /* ERROR "overflows" */ v6 = 42 v7 = v6 + 9223372036854775807 v8 = v6 + 9223372036854775808 /* ERROR "overflows" */ v9 = i + 1 << 10 v10 byte = 1024 /* ERROR "overflows" */ v11 = xx/yy*yy - xx v12 = true && false v13 = nil /* ERROR "use of untyped nil" */ ) // Multiple assignment expressions var ( m1a, m1b = 1, 2 m2a, m2b, m2c /* ERROR "missing init expr for m2c" */ = 1, 2 m3a, m3b = 1, 2, 3 /* ERROR "extra init expr 3" */ ) func _() { var ( m1a, m1b = 1, 2 m2a, m2b, m2c /* ERROR "missing init expr for m2c" */ = 1, 2 m3a, m3b = 1, 2, 3 /* ERROR "extra init expr 3" */ ) _, _ = m1a, m1b _, _, _ = m2a, m2b, m2c _, _ = m3a, m3b } // Declaration of parameters and results func f0() {} func f1(a /* ERROR "not a type" */) {} func f2(a, b, c d /* ERROR "not a type" */) {} func f3() int { return 0 } func f4() a /* ERROR "not a type" */ { return 0 } func f5() (a, b, c d /* ERROR "not a type" */) { return } func f6(a, b, c int) complex128 { return 0 } // Declaration of receivers type T struct{} func (T) m0() {} func (*T) m1() {} func (x T) m2() {} func (x *T) m3() {} // Initialization functions func init() {} func /* ERROR "no arguments and no return values" */ init(int) {} func /* ERROR "no arguments and no return values" */ init() int { return 0 } func /* ERROR "no arguments and no return values" */ init(int) int { return 0 } func (T) init(int) int { return 0 }
Upload File
Create Folder