Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
decl.go42 linesDownload Raw Back to test
1// run2 3// Copyright 2009 The Go Authors. All rights reserved.4// Use of this source code is governed by a BSD-style5// license that can be found in the LICENSE file.6 7// Test correct short declarations and redeclarations.8 9package main10 11func f1() int                    { return 1 }12func f2() (float32, int)         { return 1, 2 }13func f3() (float32, int, string) { return 1, 2, "3" }14 15func x() (s string) {16	a, b, s := f3()17	_, _ = a, b18	return // tests that result var is in scope for redeclaration19}20 21func main() {22	i, f, s := f3()23	j, f := f2() // redeclare f24	k := f1()25	m, g, s := f3()26	m, h, s := f3()27	{28		// new block should be ok.29		i, f, s := f3()30		j, f := f2() // redeclare f31		k := f1()32		m, g, s := f3()33		m, h, s := f3()34		_, _, _, _, _, _, _, _, _ = i, f, s, j, k, m, g, s, h35	}36	if y := x(); y != "3" {37		println("x() failed", y)38		panic("fail")39	}40	_, _, _, _, _, _, _, _, _ = i, f, s, j, k, m, g, s, h41}42 
codekingpro/portable-devtools · Team Ai