]> Cypherpunks repositories - gostls13.git/commitdiff
add another test to decl to see that result vars are redeclarable.
authorRob Pike <r@golang.org>
Mon, 20 Apr 2009 04:12:13 +0000 (21:12 -0700)
committerRob Pike <r@golang.org>
Mon, 20 Apr 2009 04:12:13 +0000 (21:12 -0700)
R=ken
OCL=27620
CL=27620

test/decl.go

index 6229db9b1e55b21a4d0273defa0da2857dbaa1de..596a6e5fc95391e3c642d08dfad5b795e9e7fe0f 100644 (file)
@@ -12,6 +12,11 @@ func f1() int { return 1 }
 func f2() (float, int) { return 1, 2 }
 func f3() (float, int, string) { return 1, 2, "3" }
 
+func x() (s string) {
+       a, b, s := f3();
+       return  // tests that result var is in scope for redeclaration
+}
+
 func main() {
        i, f, s := f3();
        j, f := f2();   // redeclare f
@@ -26,4 +31,7 @@ func main() {
                m, g, s := f3();
                m, h, s := f3();
        }
+       if x() != "3" {
+               println("g() failed");
+       }
 }