fix "declared and not used" in tests;
also template/template.go, missed last time.
R=r
DELTA=116 (61 added, 10 deleted, 45 changed)
OCL=34620
CL=34622
diff --git a/test/fixedbugs/bug008.go b/test/fixedbugs/bug008.go
index 7e7c5ca7..2baead1 100644
--- a/test/fixedbugs/bug008.go
+++ b/test/fixedbugs/bug008.go
@@ -10,9 +10,9 @@
i5 := 5;
switch { // compiler crash fixable with 'switch true'
- case i5 < 5: dummy := 0;
- case i5 == 5: dummy := 0;
- case i5 > 5: dummy := 0;
+ case i5 < 5: dummy := 0; _ = dummy;
+ case i5 == 5: dummy := 0; _ = dummy;
+ case i5 > 5: dummy := 0; _ = dummy;
}
}
/*
diff --git a/test/fixedbugs/bug009.go b/test/fixedbugs/bug009.go
index f52cd84..ef8263b 100644
--- a/test/fixedbugs/bug009.go
+++ b/test/fixedbugs/bug009.go
@@ -8,7 +8,7 @@
func main() {
- fired := false;
+ fired := false; _ = fired;
}
/*
bug9.go:5: defaultlit: unknown literal: LITERAL-B0 a(1)
diff --git a/test/fixedbugs/bug011.go b/test/fixedbugs/bug011.go
index 63673c0..551adb7 100644
--- a/test/fixedbugs/bug011.go
+++ b/test/fixedbugs/bug011.go
@@ -20,6 +20,7 @@
t.x = 1;
t.y = 2;
r10 := t.m(1, 3.0);
+ _ = r10;
}
/*
bug11.go:16: fatal error: walktype: switch 1 unknown op CALLMETH l(16) <int32>INT32
diff --git a/test/fixedbugs/bug012.go b/test/fixedbugs/bug012.go
index 41d1bf6..ffd5b55 100644
--- a/test/fixedbugs/bug012.go
+++ b/test/fixedbugs/bug012.go
@@ -10,6 +10,7 @@
func main() {
var u30 uint64 = 0;
var u31 uint64 = 1;
+ _, _ = u30, u31;
var u32 uint64 = 18446744073709551615;
var u33 uint64 = +18446744073709551615;
if u32 != (1<<64)-1 { panic("u32\n"); }
diff --git a/test/fixedbugs/bug013.go b/test/fixedbugs/bug013.go
index 33b532b..4b10677 100644
--- a/test/fixedbugs/bug013.go
+++ b/test/fixedbugs/bug013.go
@@ -9,6 +9,7 @@
func main() {
var cu0 uint16 = '\u1234';
var cU1 uint32 = '\U00101234';
+ _, _ = cu0, cU1;
}
/*
bug13.go:4: missing '
diff --git a/test/fixedbugs/bug017.go b/test/fixedbugs/bug017.go
index eedc6d7..fdc986d 100644
--- a/test/fixedbugs/bug017.go
+++ b/test/fixedbugs/bug017.go
@@ -8,6 +8,7 @@
func main() {
var s2 string = "\a\b\f\n\r\t\v"; // \r is miscompiled
+ _ = s2;
}
/*
main.go.c: In function ‘main_main’:
diff --git a/test/fixedbugs/bug023.go b/test/fixedbugs/bug023.go
index cce8c45..b3d3d4a 100644
--- a/test/fixedbugs/bug023.go
+++ b/test/fixedbugs/bug023.go
@@ -22,6 +22,7 @@
func main() {
var t Type;
t = nil;
+ _ = t;
}
/*
diff --git a/test/fixedbugs/bug024.go b/test/fixedbugs/bug024.go
index 0f4b2ca..c7b17b7 100644
--- a/test/fixedbugs/bug024.go
+++ b/test/fixedbugs/bug024.go
@@ -12,6 +12,7 @@
i = '\\';
var s string;
s = "\"";
+ _, _ = i, s;
}
/*
bug.go:5: unknown escape sequence: '
diff --git a/test/fixedbugs/bug031.go b/test/fixedbugs/bug031.go
index 061a89d..acb4741 100644
--- a/test/fixedbugs/bug031.go
+++ b/test/fixedbugs/bug031.go
@@ -23,6 +23,7 @@
"xxxxxxxx"+
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
;
+_ = prog;
}
/* Segmentation fault */
diff --git a/test/fixedbugs/bug053.go b/test/fixedbugs/bug053.go
index 602b0a1..c981403 100644
--- a/test/fixedbugs/bug053.go
+++ b/test/fixedbugs/bug053.go
@@ -8,4 +8,5 @@
func main() {
var len int; // len should not be a keyword - this doesn't compile
+ _ = len;
}
diff --git a/test/fixedbugs/bug055.go b/test/fixedbugs/bug055.go
index a8b1a6c..3b6d864 100644
--- a/test/fixedbugs/bug055.go
+++ b/test/fixedbugs/bug055.go
@@ -17,5 +17,6 @@
i = 0;
type s2 int;
var k = func (a int) int { return a+1 }(3);
+ _, _ = j, k;
ro:
}
diff --git a/test/fixedbugs/bug057.go b/test/fixedbugs/bug057.go
index 3847dff..d5d0f1d 100644
--- a/test/fixedbugs/bug057.go
+++ b/test/fixedbugs/bug057.go
@@ -16,6 +16,7 @@
l1 := len(s);
var t T;
l2 := len(t.s); // BUG: cannot take len() of a string field
+ _, _ = l1, l2;
}
/*
diff --git a/test/fixedbugs/bug061.go b/test/fixedbugs/bug061.go
index 1b78028..aedcf70 100644
--- a/test/fixedbugs/bug061.go
+++ b/test/fixedbugs/bug061.go
@@ -9,6 +9,7 @@
func main() {
var s string;
s = "0000000000000000000000000000000000000000000000000000000000"[0:7];
+ _ = s;
}
/*
diff --git a/test/fixedbugs/bug069.go b/test/fixedbugs/bug069.go
index 950ba8e..d6796cd 100644
--- a/test/fixedbugs/bug069.go
+++ b/test/fixedbugs/bug069.go
@@ -9,10 +9,12 @@
func main(){
c := make(chan int);
ok := false;
- i := 0;
+ var i int;
i, ok = <-c; // works
+ _, _ = i, ok;
ca := new([2]chan int);
i, ok = <-(ca[0]); // fails: c.go:11: bad shape across assignment - cr=1 cl=2
+ _, _ = i, ok;
}
diff --git a/test/fixedbugs/bug070.go b/test/fixedbugs/bug070.go
index cdd5fc3..6afdd46 100644
--- a/test/fixedbugs/bug070.go
+++ b/test/fixedbugs/bug070.go
@@ -7,7 +7,7 @@
package main
func main() {
- var i, j, k int;
+ var i, k int;
outer:
for k=0; k<2; k++ {
print("outer loop top k ", k, "\n");
diff --git a/test/fixedbugs/bug071.go b/test/fixedbugs/bug071.go
index 665a441..a5003ff 100644
--- a/test/fixedbugs/bug071.go
+++ b/test/fixedbugs/bug071.go
@@ -19,4 +19,5 @@
func dosplit(in *dch){
dat := <-in.dat;
+ _ = dat;
}
diff --git a/test/fixedbugs/bug075.go b/test/fixedbugs/bug075.go
index fceeef8..7aed130 100644
--- a/test/fixedbugs/bug075.go
+++ b/test/fixedbugs/bug075.go
@@ -13,4 +13,5 @@
var x int;
var ok bool;
x, ok = t.m[0]; //bug075.go:11: bad shape across assignment - cr=1 cl=2
+ _, _ = x, ok;
}
diff --git a/test/fixedbugs/bug077.go b/test/fixedbugs/bug077.go
index ba6e3b7..08028ab 100644
--- a/test/fixedbugs/bug077.go
+++ b/test/fixedbugs/bug077.go
@@ -9,4 +9,5 @@
func main() {
var exit int;
exit:
+ _ = exit;
}
diff --git a/test/fixedbugs/bug084.go b/test/fixedbugs/bug084.go
index 2897593..7556f8d 100644
--- a/test/fixedbugs/bug084.go
+++ b/test/fixedbugs/bug084.go
@@ -20,4 +20,5 @@
c := make(chan string);
a := new(Service);
go a.Serve(1234);
+ _ = c;
}
diff --git a/test/fixedbugs/bug087.go b/test/fixedbugs/bug087.go
index 6b5e565..4af8d97 100644
--- a/test/fixedbugs/bug087.go
+++ b/test/fixedbugs/bug087.go
@@ -10,6 +10,7 @@
func main() {
i := len(s); // should be legal to take len() of a constant
+ _ = i;
}
/*
diff --git a/test/fixedbugs/bug088.dir/bug1.go b/test/fixedbugs/bug088.dir/bug1.go
index 9cb6032..cadf0e6 100644
--- a/test/fixedbugs/bug088.dir/bug1.go
+++ b/test/fixedbugs/bug088.dir/bug1.go
@@ -10,6 +10,7 @@
a0 := P.V0(); // works
a1 := P.V1(); // works
a2, b2 := P.V2(); // doesn't work
+ _, _, _, _ = a0, a1, a2, b2;
}
/*
diff --git a/test/fixedbugs/bug092.go b/test/fixedbugs/bug092.go
index 8f18c38..8f05c47 100644
--- a/test/fixedbugs/bug092.go
+++ b/test/fixedbugs/bug092.go
@@ -9,6 +9,7 @@
func main() {
var a [1000] int64; // this alone works
var b [10000] int64; // this causes a runtime crash
+ _, _ = a, b;
}
/*
diff --git a/test/fixedbugs/bug094.go b/test/fixedbugs/bug094.go
index 5c5154e..2953eb2 100644
--- a/test/fixedbugs/bug094.go
+++ b/test/fixedbugs/bug094.go
@@ -13,6 +13,7 @@
func f1() {
x := 0;
+ _ = x;
}
@@ -27,5 +28,5 @@
bad top
. LITERAL-I0 l(343)
bug094.go:11: fatal error: walktype: top=3 LITERAL
-uetli:~/Source/go1/test/bugs gri$
+uetli:~/Source/go1/test/bugs gri$
*/
diff --git a/test/fixedbugs/bug096.go b/test/fixedbugs/bug096.go
index 81d6c4a..9be687a 100644
--- a/test/fixedbugs/bug096.go
+++ b/test/fixedbugs/bug096.go
@@ -11,6 +11,7 @@
func main() {
a := &A{0};
b := &A{0, 1};
+ _, _ = a, b;
}
/*
diff --git a/test/fixedbugs/bug098.go b/test/fixedbugs/bug098.go
index 8e790a7..1dad4d5 100644
--- a/test/fixedbugs/bug098.go
+++ b/test/fixedbugs/bug098.go
@@ -12,6 +12,7 @@
func main() {
var a *A = &A{0};
var m *M = &M{0 : 0}; // should be legal to use & here for consistency with other composite constructors (prev. line)
+ _, _ = a, m;
}
/*
diff --git a/test/fixedbugs/bug129.go b/test/fixedbugs/bug129.go
index 1097b1b..f9f6dd0 100644
--- a/test/fixedbugs/bug129.go
+++ b/test/fixedbugs/bug129.go
@@ -7,5 +7,6 @@
package foo
import "fmt"
func f() {
- fmt := 1
+ fmt := 1;
+ _ = fmt;
}
diff --git a/test/fixedbugs/bug135.go b/test/fixedbugs/bug135.go
index 252aa87..470135e 100644
--- a/test/fixedbugs/bug135.go
+++ b/test/fixedbugs/bug135.go
@@ -15,4 +15,5 @@
t := new(T);
var i interface {};
f, ok := i.(Foo);
+ _, _, _ = t, f, ok;
}
diff --git a/test/fixedbugs/bug143.go b/test/fixedbugs/bug143.go
index cb86310..af96075 100644
--- a/test/fixedbugs/bug143.go
+++ b/test/fixedbugs/bug143.go
@@ -29,7 +29,8 @@
{
var x int;
var ok bool;
- x, ok = f()["key"]
+ x, ok = f()["key"];
+ _, _ = x, ok;
}
}
diff --git a/test/fixedbugs/bug144.go b/test/fixedbugs/bug144.go
index 916566e..bab9a44 100644
--- a/test/fixedbugs/bug144.go
+++ b/test/fixedbugs/bug144.go
@@ -10,6 +10,7 @@
func main() {
c := 0;
+ _ = c;
}
/*
diff --git a/test/fixedbugs/bug145.go b/test/fixedbugs/bug145.go
index 0b41ab5..c59bceb 100644
--- a/test/fixedbugs/bug145.go
+++ b/test/fixedbugs/bug145.go
@@ -9,7 +9,8 @@
type t int
func main() {
- t := 0
+ t := 0;
+ _ = t;
}
/*
diff --git a/test/fixedbugs/bug154.go b/test/fixedbugs/bug154.go
index 66f7212..4371cc5 100644
--- a/test/fixedbugs/bug154.go
+++ b/test/fixedbugs/bug154.go
@@ -17,6 +17,7 @@
func f1() string {
const f = 3.141592;
x := float64(float32(f)); // appears to change the precision of f
+ _ = x;
return fmt.Sprintf("%v", float64(f));
}
diff --git a/test/fixedbugs/bug179.go b/test/fixedbugs/bug179.go
index 690b012..6754873 100644
--- a/test/fixedbugs/bug179.go
+++ b/test/fixedbugs/bug179.go
@@ -17,6 +17,7 @@
L1:
x := 1;
+ _ = x;
for {
break L1; // ERROR "L1"
continue L1; // ERROR "L1"
diff --git a/test/fixedbugs/bug187.go b/test/fixedbugs/bug187.go
index 12389e7..66aa5f0 100644
--- a/test/fixedbugs/bug187.go
+++ b/test/fixedbugs/bug187.go
@@ -12,7 +12,6 @@
// This bug doesn't arise with [...]int, or []interface{} or [3]interface{}.
a := [...]interface{} { 1, 2, 3 };
n := 1;
- bug := false;
for _, v := range a {
if v.(int) != n {
println("BUG:", n, v.(int));
diff --git a/test/fixedbugs/bug202.go b/test/fixedbugs/bug202.go
index 7e5cc7a..2fc91b5 100644
--- a/test/fixedbugs/bug202.go
+++ b/test/fixedbugs/bug202.go
@@ -6,11 +6,11 @@
package main
func f() {
- v := [...]string{"a", "b"};
+ v := [...]string{"a", "b"};
+ _ = v;
}
func main() {
f();
}
-
\ No newline at end of file