github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/types/testdata/check/expr3.go (about) 1 // Copyright 2012 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package expr3 6 7 import "time" 8 9 func indexes() { 10 _ = 1 /* ERROR "cannot index" */ [0] 11 _ = indexes /* ERROR "cannot index" */ [0] 12 _ = ( /* ERROR "cannot slice" */ 12 + 3)[1:2] 13 14 var a [10]int 15 _ = a[true /* ERROR "cannot convert" */ ] 16 _ = a["foo" /* ERROR "cannot convert" */ ] 17 _ = a[1.1 /* ERROR "truncated" */ ] 18 _ = a[1.0] 19 _ = a[- /* ERROR "negative" */ 1] 20 _ = a[- /* ERROR "negative" */ 1 :] 21 _ = a[: - /* ERROR "negative" */ 1] 22 _ = a[: /* ERROR "middle index required" */ : /* ERROR "final index required" */ ] 23 _ = a[0: /* ERROR "middle index required" */ : /* ERROR "final index required" */ ] 24 _ = a[0: /* ERROR "middle index required" */ :10] 25 _ = a[:10:10] 26 27 var a0 int 28 a0 = a[0] 29 _ = a0 30 var a1 int32 31 a1 = a /* ERRORx `cannot use .* in assignment` */ [1] 32 _ = a1 33 34 _ = a[9] 35 _ = a[10 /* ERRORx `index .* out of bounds` */ ] 36 _ = a[1 /* ERROR "overflows" */ <<100] 37 _ = a[1<< /* ERROR "constant shift overflow" */ 1000] // no out-of-bounds follow-on error 38 _ = a[10:] 39 _ = a[:10] 40 _ = a[10:10] 41 _ = a[11 /* ERRORx `index .* out of bounds` */ :] 42 _ = a[: 11 /* ERRORx `index .* out of bounds` */ ] 43 _ = a[: 1 /* ERROR "overflows" */ <<100] 44 _ = a[:10:10] 45 _ = a[:11 /* ERRORx `index .* out of bounds` */ :10] 46 _ = a[:10:11 /* ERRORx `index .* out of bounds` */ ] 47 _ = a[10:0 /* ERROR "invalid slice indices" */ :10] 48 _ = a[0:10:0 /* ERROR "invalid slice indices" */ ] 49 _ = a[10:0 /* ERROR "invalid slice indices" */:0] 50 _ = &a /* ERROR "cannot take address" */ [:10] 51 52 pa := &a 53 _ = pa[9] 54 _ = pa[10 /* ERRORx `index .* out of bounds` */ ] 55 _ = pa[1 /* ERROR "overflows" */ <<100] 56 _ = pa[10:] 57 _ = pa[:10] 58 _ = pa[10:10] 59 _ = pa[11 /* ERRORx `index .* out of bounds` */ :] 60 _ = pa[: 11 /* ERRORx `index .* out of bounds` */ ] 61 _ = pa[: 1 /* ERROR "overflows" */ <<100] 62 _ = pa[:10:10] 63 _ = pa[:11 /* ERRORx `index .* out of bounds` */ :10] 64 _ = pa[:10:11 /* ERRORx `index .* out of bounds` */ ] 65 _ = pa[10:0 /* ERROR "invalid slice indices" */ :10] 66 _ = pa[0:10:0 /* ERROR "invalid slice indices" */ ] 67 _ = pa[10:0 /* ERROR "invalid slice indices" */ :0] 68 _ = &pa /* ERROR "cannot take address" */ [:10] 69 70 var b [0]int 71 _ = b[0 /* ERRORx `index .* out of bounds` */ ] 72 _ = b[:] 73 _ = b[0:] 74 _ = b[:0] 75 _ = b[0:0] 76 _ = b[0:0:0] 77 _ = b[1 /* ERRORx `index .* out of bounds` */ :0:0] 78 79 var s []int 80 _ = s[- /* ERROR "negative" */ 1] 81 _ = s[- /* ERROR "negative" */ 1 :] 82 _ = s[: - /* ERROR "negative" */ 1] 83 _ = s[0] 84 _ = s[1:2] 85 _ = s[2:1 /* ERROR "invalid slice indices" */ ] 86 _ = s[2:] 87 _ = s[: 1 /* ERROR "overflows" */ <<100] 88 _ = s[1 /* ERROR "overflows" */ <<100 :] 89 _ = s[1 /* ERROR "overflows" */ <<100 : 1 /* ERROR "overflows" */ <<100] 90 _ = s[: /* ERROR "middle index required" */ : /* ERROR "final index required" */ ] 91 _ = s[:10:10] 92 _ = s[10:0 /* ERROR "invalid slice indices" */ :10] 93 _ = s[0:10:0 /* ERROR "invalid slice indices" */ ] 94 _ = s[10:0 /* ERROR "invalid slice indices" */ :0] 95 _ = &s /* ERROR "cannot take address" */ [:10] 96 97 var m map[string]int 98 _ = m[0 /* ERRORx `cannot use .* in map index` */ ] 99 _ = m /* ERROR "cannot slice" */ ["foo" : "bar"] 100 _ = m["foo"] 101 // ok is of type bool 102 type mybool bool 103 var ok mybool 104 _, ok = m["bar"] 105 _ = ok 106 _ = m/* ERROR "mismatched types int and untyped string" */[0 /* ERROR "cannot use 0" */ ] + "foo" 107 108 var t string 109 _ = t[- /* ERROR "negative" */ 1] 110 _ = t[- /* ERROR "negative" */ 1 :] 111 _ = t[: - /* ERROR "negative" */ 1] 112 _ = t[1:2:3 /* ERROR "3-index slice of string" */ ] 113 _ = "foo"[1:2:3 /* ERROR "3-index slice of string" */ ] 114 var t0 byte 115 t0 = t[0] 116 _ = t0 117 var t1 rune 118 t1 = t /* ERRORx `cannot use .* in assignment` */ [2] 119 _ = t1 120 _ = ("foo" + "bar")[5] 121 _ = ("foo" + "bar")[6 /* ERRORx `index .* out of bounds` */ ] 122 123 const c = "foo" 124 _ = c[- /* ERROR "negative" */ 1] 125 _ = c[- /* ERROR "negative" */ 1 :] 126 _ = c[: - /* ERROR "negative" */ 1] 127 var c0 byte 128 c0 = c[0] 129 _ = c0 130 var c2 float32 131 c2 = c /* ERRORx `cannot use .* in assignment` */ [2] 132 _ = c[3 /* ERRORx `index .* out of bounds` */ ] 133 _ = ""[0 /* ERRORx `index .* out of bounds` */ ] 134 _ = c2 135 136 _ = s[1<<30] // no compile-time error here 137 138 // issue 4913 139 type mystring string 140 var ss string 141 var ms mystring 142 var i, j int 143 ss = "foo"[1:2] 144 ss = "foo"[i:j] 145 ms = "foo" /* ERRORx `cannot use .* in assignment` */ [1:2] 146 ms = "foo" /* ERRORx `cannot use .* in assignment` */ [i:j] 147 _, _ = ss, ms 148 } 149 150 type T struct { 151 x int 152 y func() 153 } 154 155 func (*T) m() {} 156 157 func method_expressions() { 158 _ = T.a /* ERROR "no field or method" */ 159 _ = T.x /* ERROR "has no method" */ 160 _ = T.m /* ERROR "invalid method expression T.m (needs pointer receiver (*T).m)" */ 161 _ = (*T).m 162 163 var f func(*T) = T.m /* ERROR "invalid method expression T.m (needs pointer receiver (*T).m)" */ 164 var g func(*T) = (*T).m 165 _, _ = f, g 166 167 _ = T.y /* ERROR "has no method" */ 168 _ = (*T).y /* ERROR "has no method" */ 169 } 170 171 func struct_literals() { 172 type T0 struct { 173 a, b, c int 174 } 175 176 type T1 struct { 177 T0 178 a, b int 179 u float64 180 s string 181 } 182 183 // keyed elements 184 _ = T1{} 185 _ = T1{a: 0, 1 /* ERRORx `mixture of .* elements` */ } 186 _ = T1{aa /* ERROR "unknown field" */ : 0} 187 _ = T1{1 /* ERROR "invalid field name" */ : 0} 188 _ = T1{a: 0, s: "foo", u: 0, a /* ERROR "duplicate field" */: 10} 189 _ = T1{a: "foo" /* ERRORx `cannot use .* in struct literal` */ } 190 _ = T1{c /* ERROR "unknown field" */ : 0} 191 _ = T1{T0: { /* ERROR "missing type" */ }} // struct literal element type may not be elided 192 _ = T1{T0: T0{}} 193 _ = T1{T0 /* ERROR "invalid field name" */ .a: 0} 194 195 // unkeyed elements 196 _ = T0{1, 2, 3} 197 _ = T0{1, b /* ERROR "mixture" */ : 2, 3} 198 _ = T0{1, 2} /* ERROR "too few values" */ 199 _ = T0{1, 2, 3, 4 /* ERROR "too many values" */ } 200 _ = T0{1, "foo" /* ERRORx `cannot use .* in struct literal` */, 3.4 /* ERRORx `cannot use .*\(truncated\)` */} 201 202 // invalid type 203 type P *struct{ 204 x int 205 } 206 _ = P /* ERROR "invalid composite literal type" */ {} 207 208 // unexported fields 209 _ = time.Time{} 210 _ = time.Time{sec /* ERROR "unknown field" */ : 0} 211 _ = time.Time{ 212 0 /* ERROR "implicit assignment to unexported field wall in struct literal" */, 213 0 /* ERROR "implicit assignment" */ , 214 nil /* ERROR "implicit assignment" */ , 215 } 216 } 217 218 func array_literals() { 219 type A0 [0]int 220 _ = A0{} 221 _ = A0{0 /* ERRORx `index .* out of bounds` */} 222 _ = A0{0 /* ERRORx `index .* out of bounds` */ : 0} 223 224 type A1 [10]int 225 _ = A1{} 226 _ = A1{0, 1, 2} 227 _ = A1{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} 228 _ = A1{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 /* ERRORx `index .* out of bounds` */ } 229 _ = A1{- /* ERROR "negative" */ 1: 0} 230 _ = A1{8: 8, 9} 231 _ = A1{8: 8, 9, 10 /* ERRORx `index .* out of bounds` */ } 232 _ = A1{0, 1, 2, 0 /* ERROR "duplicate index" */ : 0, 3: 3, 4} 233 _ = A1{5: 5, 6, 7, 3: 3, 4} 234 _ = A1{5: 5, 6, 7, 3: 3, 4, 5 /* ERROR "duplicate index" */ } 235 _ = A1{10 /* ERRORx `index .* out of bounds` */ : 10, 10 /* ERRORx `index .* out of bounds` */ : 10} 236 _ = A1{5: 5, 6, 7, 3: 3, 1 /* ERROR "overflows" */ <<100: 4, 5 /* ERROR "duplicate index" */ } 237 _ = A1{5: 5, 6, 7, 4: 4, 1 /* ERROR "overflows" */ <<100: 4} 238 _ = A1{2.0} 239 _ = A1{2.1 /* ERROR "truncated" */ } 240 _ = A1{"foo" /* ERRORx `cannot use .* in array or slice literal` */ } 241 242 // indices must be integer constants 243 i := 1 244 const f = 2.1 245 const s = "foo" 246 _ = A1{i /* ERROR "index i must be integer constant" */ : 0} 247 _ = A1{f /* ERROR "truncated" */ : 0} 248 _ = A1{s /* ERROR "cannot convert" */ : 0} 249 250 a0 := [...]int{} 251 assert(len(a0) == 0) 252 253 a1 := [...]int{0, 1, 2} 254 assert(len(a1) == 3) 255 var a13 [3]int 256 var a14 [4]int 257 a13 = a1 258 a14 = a1 /* ERRORx `cannot use .* in assignment` */ 259 _, _ = a13, a14 260 261 a2 := [...]int{- /* ERROR "negative" */ 1: 0} 262 _ = a2 263 264 a3 := [...]int{0, 1, 2, 0 /* ERROR "duplicate index" */ : 0, 3: 3, 4} 265 assert(len(a3) == 5) // somewhat arbitrary 266 267 a4 := [...]complex128{0, 1, 2, 1<<10-2: -1i, 1i, 400: 10, 12, 14} 268 assert(len(a4) == 1024) 269 270 // composite literal element types may be elided 271 type T []int 272 _ = [10]T{T{}, {}, 5: T{1, 2, 3}, 7: {1, 2, 3}} 273 a6 := [...]T{T{}, {}, 5: T{1, 2, 3}, 7: {1, 2, 3}} 274 assert(len(a6) == 8) 275 276 // recursively so 277 _ = [10][10]T{{}, [10]T{{}}, {{1, 2, 3}}} 278 279 // from the spec 280 type Point struct { x, y float32 } 281 _ = [...]Point{Point{1.5, -3.5}, Point{0, 0}} 282 _ = [...]Point{{1.5, -3.5}, {0, 0}} 283 _ = [][]int{[]int{1, 2, 3}, []int{4, 5}} 284 _ = [][]int{{1, 2, 3}, {4, 5}} 285 _ = [...]*Point{&Point{1.5, -3.5}, &Point{0, 0}} 286 _ = [...]*Point{{1.5, -3.5}, {0, 0}} 287 } 288 289 func slice_literals() { 290 type S0 []int 291 _ = S0{} 292 _ = S0{0, 1, 2} 293 _ = S0{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} 294 _ = S0{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} 295 _ = S0{- /* ERROR "negative" */ 1: 0} 296 _ = S0{8: 8, 9} 297 _ = S0{8: 8, 9, 10} 298 _ = S0{0, 1, 2, 0 /* ERROR "duplicate index" */ : 0, 3: 3, 4} 299 _ = S0{5: 5, 6, 7, 3: 3, 4} 300 _ = S0{5: 5, 6, 7, 3: 3, 4, 5 /* ERROR "duplicate index" */ } 301 _ = S0{10: 10, 10 /* ERROR "duplicate index" */ : 10} 302 _ = S0{5: 5, 6, 7, 3: 3, 1 /* ERROR "overflows" */ <<100: 4, 5 /* ERROR "duplicate index" */ } 303 _ = S0{5: 5, 6, 7, 4: 4, 1 /* ERROR "overflows" */ <<100: 4} 304 _ = S0{2.0} 305 _ = S0{2.1 /* ERROR "truncated" */ } 306 _ = S0{"foo" /* ERRORx `cannot use .* in array or slice literal` */ } 307 308 // indices must be resolved correctly 309 const index1 = 1 310 _ = S0{index1: 1} 311 _ = S0{index2: 2} 312 _ = S0{index3 /* ERROR "undefined" */ : 3} 313 314 // indices must be integer constants 315 i := 1 316 const f = 2.1 317 const s = "foo" 318 _ = S0{i /* ERROR "index i must be integer constant" */ : 0} 319 _ = S0{f /* ERROR "truncated" */ : 0} 320 _ = S0{s /* ERROR "cannot convert" */ : 0} 321 322 // composite literal element types may be elided 323 type T []int 324 _ = []T{T{}, {}, 5: T{1, 2, 3}, 7: {1, 2, 3}} 325 _ = [][]int{{1, 2, 3}, {4, 5}} 326 327 // recursively so 328 _ = [][]T{{}, []T{{}}, {{1, 2, 3}}} 329 330 // issue 17954 331 type T0 *struct { s string } 332 _ = []T0{{}} 333 _ = []T0{{"foo"}} 334 335 type T1 *struct{ int } 336 _ = []T1{} 337 _ = []T1{{0}, {1}, {2}} 338 339 type T2 T1 340 _ = []T2{} 341 _ = []T2{{0}, {1}, {2}} 342 343 _ = map[T0]T2{} 344 _ = map[T0]T2{{}: {}} 345 } 346 347 const index2 int = 2 348 349 type N int 350 func (N) f() {} 351 352 func map_literals() { 353 type M0 map[string]int 354 type M1 map[bool]int 355 type M2 map[*int]int 356 357 _ = M0{} 358 _ = M0{1 /* ERROR "missing key" */ } 359 _ = M0{1 /* ERRORx `cannot use .* in map literal` */ : 2} 360 _ = M0{"foo": "bar" /* ERRORx `cannot use .* in map literal` */ } 361 _ = M0{"foo": 1, "bar": 2, "foo" /* ERROR "duplicate key" */ : 3 } 362 363 _ = map[interface{}]int{2: 1, 2 /* ERROR "duplicate key" */ : 1} 364 _ = map[interface{}]int{int(2): 1, int16(2): 1} 365 _ = map[interface{}]int{int16(2): 1, int16 /* ERROR "duplicate key" */ (2): 1} 366 367 type S string 368 369 _ = map[interface{}]int{"a": 1, "a" /* ERROR "duplicate key" */ : 1} 370 _ = map[interface{}]int{"a": 1, S("a"): 1} 371 _ = map[interface{}]int{S("a"): 1, S /* ERROR "duplicate key" */ ("a"): 1} 372 _ = map[interface{}]int{1.0: 1, 1.0 /* ERROR "duplicate key" */: 1} 373 _ = map[interface{}]int{int64(-1): 1, int64 /* ERROR "duplicate key" */ (-1) : 1} 374 _ = map[interface{}]int{^uint64(0): 1, ^ /* ERROR "duplicate key" */ uint64(0): 1} 375 _ = map[interface{}]int{complex(1,2): 1, complex /* ERROR "duplicate key" */ (1,2) : 1} 376 377 type I interface { 378 f() 379 } 380 381 _ = map[I]int{N(0): 1, N(2): 1} 382 _ = map[I]int{N(2): 1, N /* ERROR "duplicate key" */ (2): 1} 383 384 // map keys must be resolved correctly 385 key1 := "foo" 386 _ = M0{key1: 1} 387 _ = M0{key2: 2} 388 _ = M0{key3 /* ERROR "undefined" */ : 2} 389 390 var value int 391 _ = M1{true: 1, false: 0} 392 _ = M2{nil: 0, &value: 1} 393 394 // composite literal element types may be elided 395 type T [2]int 396 _ = map[int]T{0: T{3, 4}, 1: {5, 6}} 397 398 // recursively so 399 _ = map[int][]T{0: {}, 1: {{}, T{1, 2}}} 400 401 // composite literal key types may be elided 402 _ = map[T]int{T{3, 4}: 0, {5, 6}: 1} 403 404 // recursively so 405 _ = map[[2]T]int{{}: 0, {{}}: 1, [2]T{{}}: 2, {T{1, 2}}: 3} 406 407 // composite literal element and key types may be elided 408 _ = map[T]T{{}: {}, {1, 2}: T{3, 4}, T{4, 5}: {}} 409 _ = map[T]M0{{} : {}, T{1, 2}: M0{"foo": 0}, {1, 3}: {"foo": 1}} 410 411 // recursively so 412 _ = map[[2]T][]T{{}: {}, {{}}: {{}, T{1, 2}}, [2]T{{}}: nil, {T{1, 2}}: {{}, {}}} 413 414 // from the spec 415 type Point struct { x, y float32 } 416 _ = map[string]Point{"orig": {0, 0}} 417 _ = map[*Point]string{{0, 0}: "orig"} 418 419 // issue 17954 420 type T0 *struct{ s string } 421 type T1 *struct{ int } 422 type T2 T1 423 424 _ = map[T0]T2{} 425 _ = map[T0]T2{{}: {}} 426 } 427 428 var key2 string = "bar" 429 430 type I interface { 431 m() 432 } 433 434 type I2 interface { 435 m(int) 436 } 437 438 type T1 struct{} 439 type T2 struct{} 440 441 func (T2) m(int) {} 442 443 type mybool bool 444 445 func type_asserts() { 446 var x int 447 _ = x /* ERROR "not an interface" */ .(int) 448 449 var e interface{} 450 var ok bool 451 x, ok = e.(int) 452 _ = ok 453 454 // ok value is of type bool 455 var myok mybool 456 _, myok = e.(int) 457 _ = myok 458 459 var t I 460 _ = t /* ERRORx `use of .* outside type switch` */ .(type) 461 _ = t /* ERROR "m has pointer receiver" */ .(T) 462 _ = t.(*T) 463 _ = t /* ERROR "missing method m" */ .(T1) 464 _ = t /* ERROR "wrong type for method m" */ .(T2) 465 _ = t /* STRICT "wrong type for method m" */ .(I2) // only an error in strict mode (issue 8561) 466 467 // e doesn't statically have an m, but may have one dynamically. 468 _ = e.(I2) 469 } 470 471 func f0() {} 472 func f1(x int) {} 473 func f2(u float32, s string) {} 474 func fs(s []byte) {} 475 func fv(x ...int) {} 476 func fi(x ... interface{}) {} 477 func (T) fm(x ...int) 478 479 func g0() {} 480 func g1() int { return 0} 481 func g2() (u float32, s string) { return } 482 func gs() []byte { return nil } 483 484 func _calls() { 485 var x int 486 var y float32 487 var s []int 488 489 f0() 490 _ = f0 /* ERROR "used as value" */ () 491 f0(g0 /* ERROR "too many arguments" */ ) 492 493 f1(0) 494 f1(x) 495 f1(10.0) 496 f1() /* ERROR "not enough arguments in call to f1\n\thave ()\n\twant (int)" */ 497 f1(x, y /* ERROR "too many arguments in call to f1\n\thave (int, float32)\n\twant (int)" */ ) 498 f1(s /* ERRORx `cannot use .* in argument` */ ) 499 f1(x ... /* ERROR "cannot use ..." */ ) 500 f1(g0 /* ERROR "used as value" */ ()) 501 f1(g1()) 502 f1(g2 /* ERROR "too many arguments in call to f1\n\thave (float32, string)\n\twant (int)" */ ()) 503 504 f2() /* ERROR "not enough arguments in call to f2\n\thave ()\n\twant (float32, string)" */ 505 f2(3.14) /* ERROR "not enough arguments in call to f2\n\thave (number)\n\twant (float32, string)" */ 506 f2(3.14, "foo") 507 f2(x /* ERRORx `cannot use .* in argument` */ , "foo") 508 f2(g0 /* ERROR "used as value" */ ()) /* ERROR "not enough arguments in call to f2\n\thave (func())\n\twant (float32, string)" */ 509 f2(g1()) /* ERROR "not enough arguments in call to f2\n\thave (int)\n\twant (float32, string)" */ 510 f2(g2()) 511 512 fs() /* ERROR "not enough arguments" */ 513 fs(g0 /* ERROR "used as value" */ ()) 514 fs(g1 /* ERRORx `cannot use .* in argument` */ ()) 515 fs(g2 /* ERROR "too many arguments" */ ()) 516 fs(gs()) 517 518 fv() 519 fv(1, 2.0, x) 520 fv(s /* ERRORx `cannot use .* in argument` */ ) 521 fv(s...) 522 fv(x /* ERROR "cannot use" */ ...) 523 fv(1, s /* ERROR "too many arguments" */ ...) 524 fv(gs /* ERRORx `cannot use .* in argument` */ ()) 525 fv(gs /* ERRORx `cannot use .* in argument` */ ()...) 526 527 var t T 528 t.fm() 529 t.fm(1, 2.0, x) 530 t.fm(s /* ERRORx `cannot use .* in argument` */ ) 531 t.fm(g1()) 532 t.fm(1, s /* ERROR "too many arguments" */ ...) 533 t.fm(gs /* ERRORx `cannot use .* in argument` */ ()) 534 t.fm(gs /* ERRORx `cannot use .* in argument` */ ()...) 535 536 T.fm(t, ) 537 T.fm(t, 1, 2.0, x) 538 T.fm(t, s /* ERRORx `cannot use .* in argument` */ ) 539 T.fm(t, g1()) 540 T.fm(t, 1, s /* ERROR "too many arguments" */ ...) 541 T.fm(t, gs /* ERRORx `cannot use .* in argument` */ ()) 542 T.fm(t, gs /* ERRORx `cannot use .* in argument` */ ()...) 543 544 var i interface{ fm(x ...int) } = t 545 i.fm() 546 i.fm(1, 2.0, x) 547 i.fm(s /* ERRORx `cannot use .* in argument` */ ) 548 i.fm(g1()) 549 i.fm(1, s /* ERROR "too many arguments" */ ...) 550 i.fm(gs /* ERRORx `cannot use .* in argument` */ ()) 551 i.fm(gs /* ERRORx `cannot use .* in argument` */ ()...) 552 553 fi() 554 fi(1, 2.0, x, 3.14, "foo") 555 fi(g2()) 556 fi(0, g2) 557 fi(0, g2 /* ERROR "multiple-value g2" */ ()) 558 } 559 560 func issue6344() { 561 type T []interface{} 562 var x T 563 fi(x...) // ... applies also to named slices 564 }