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/src/pkg/template/template.go b/src/pkg/template/template.go
index 46003b7..4d77a54 100644
--- a/src/pkg/template/template.go
+++ b/src/pkg/template/template.go
@@ -397,12 +397,12 @@
// Is it in user-supplied map?
if t.fmap != nil {
- if fn, ok := t.fmap[formatter]; ok {
+ if _, ok := t.fmap[formatter]; ok {
return
}
}
// Is it in builtin map?
- if fn, ok := builtins[formatter]; ok {
+ if _, ok := builtins[formatter]; ok {
return
}
t.parseError("unknown formatter: %s", formatter);
@@ -631,17 +631,17 @@
val := t.varValue(v.name, st).Interface();
// is it in user-supplied map?
if t.fmap != nil {
- if fn, ok := t.fmap[v.formatter]; ok {
- fn(st.wr, val, v.formatter);
+ if fn, ok := t.fmap[formatter]; ok {
+ fn(st.wr, val, formatter);
return;
}
}
// is it in builtin map?
- if fn, ok := builtins[v.formatter]; ok {
- fn(st.wr, val, v.formatter);
+ if fn, ok := builtins[formatter]; ok {
+ fn(st.wr, val, formatter);
return;
}
- t.execError(st, v.linenum, "missing formatter %s for variable %s", v.formatter, v.name)
+ t.execError(st, v.linenum, "missing formatter %s for variable %s", formatter, v.name)
}
// Execute element i. Return next index to execute.
@@ -796,7 +796,7 @@
if len(d) == 0 {
return false
}
- for i, c := range d {
+ for _, c := range d {
if white(c) {
return false
}
diff --git a/test/235.go b/test/235.go
index fe3024c..7507a3e 100644
--- a/test/235.go
+++ b/test/235.go
@@ -53,7 +53,6 @@
}
for i := 0; i < len(OUT); i++ {
- t := min(xs);
for i := 0; i < n; i++ {
ins[i] <- x;
}
diff --git a/test/bigalg.go b/test/bigalg.go
index dba8cc4..89ece01 100644
--- a/test/bigalg.go
+++ b/test/bigalg.go
@@ -22,7 +22,6 @@
var NIL []int;
func arraycmptest() {
- a1 := a;
if NIL != nil {
println("fail1:", NIL, "!= nil");
}
@@ -112,6 +111,7 @@
i = e;
e1 := i.(E);
// nothing to check; just verify it doesn't crash
+ _ = e1;
}
func main() {
diff --git a/test/bugs/bug196.go b/test/bugs/bug196.go
index 0aa0550..b903079 100644
--- a/test/bugs/bug196.go
+++ b/test/bugs/bug196.go
@@ -26,6 +26,8 @@
xx, ok = i.(int);
a,b := multi();
+
+ _, _, _, _, _ = x, ok, xx, a, b;
}
func f() map[int]int {
diff --git a/test/complit.go b/test/complit.go
index d9b9488..3d5a684 100644
--- a/test/complit.go
+++ b/test/complit.go
@@ -46,7 +46,7 @@
oai = []int{1,2,3};
if len(oai) != 3 { panic("oai") }
- at := [...]*T{&t, &t, &t};
+ at := [...]*T{&t, tp, &t};
if len(at) != 3 { panic("at") }
c := make(chan int);
diff --git a/test/decl.go b/test/decl.go
index c2919d3..273d0ec 100644
--- a/test/decl.go
+++ b/test/decl.go
@@ -30,8 +30,10 @@
k := f1();
m, g, s := f3();
m, h, s := f3();
+ _, _, _, _, _, _, _, _, _ = i, f, s, j, k, m, g, s, h;
}
if x() != "3" {
println("x() failed");
}
+ _, _, _, _, _, _, _, _, _ = i, f, s, j, k, m, g, s, h;
}
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
diff --git a/test/gc.go b/test/gc.go
index df9d05e..0b1dd63 100644
--- a/test/gc.go
+++ b/test/gc.go
@@ -10,6 +10,7 @@
func mk2() {
b := new([10000]byte);
+ _ = b;
// println(b, "stored at", &b);
}
diff --git a/test/gc1.go b/test/gc1.go
index d746e9c..eecc036 100644
--- a/test/gc1.go
+++ b/test/gc1.go
@@ -9,5 +9,6 @@
func main() {
for i := 0; i < 1000000; i++ {
x := new([100]byte);
+ _ = x;
}
}
diff --git a/test/hashmap.go b/test/hashmap.go
index 4900781..62943a71 100755
--- a/test/hashmap.go
+++ b/test/hashmap.go
@@ -171,6 +171,7 @@
var x1 *Number = MakeNumber(1001);
var x2 *Number = MakeNumber(2002);
var x3 *Number = MakeNumber(3003);
+ _, _, _ = x1, x2, x3;
// this doesn't work I think...
//hmap.Lookup(x1, true);
diff --git a/test/if.go b/test/if.go
index a2c840e..c7f14c4 100644
--- a/test/if.go
+++ b/test/if.go
@@ -21,56 +21,57 @@
count = 0;
if true {
- count = count + 1;
+ count = count + 1;
}
assertequal(count, 1, "if true");
count = 0;
if false {
- count = count + 1;
+ count = count + 1;
}
assertequal(count, 0, "if false");
count = 0;
if one := 1; true {
- count = count + one;
+ count = count + one;
}
assertequal(count, 1, "if true one");
count = 0;
if one := 1; false {
- count = count + 1;
+ count = count + 1;
+ _ = one;
}
assertequal(count, 0, "if false one");
count = 0;
if {
- count = count + 1;
+ count = count + 1;
}
assertequal(count, 1, "if empty");
count = 0;
if one := 1; true {
- count = count + one;
+ count = count + one;
}
assertequal(count, 1, "if empty one");
count = 0;
if i5 < i7 {
- count = count + 1;
+ count = count + 1;
}
assertequal(count, 1, "if cond");
count = 0;
if true {
- count = count + 1;
+ count = count + 1;
} else
count = count - 1;
assertequal(count, 1, "if else true");
count = 0;
if false {
- count = count + 1;
+ count = count + 1;
} else
count = count - 1;
assertequal(count, -1, "if else false");
@@ -78,7 +79,9 @@
count = 0;
if t:=1; false {
count = count + 1;
- t := 7;
+ _ = t;
+ t := 7;
+ _ = t;
} else
count = count - t;
assertequal(count, -1, "if else false var");
@@ -87,8 +90,10 @@
t := 1;
if false {
count = count + 1;
- t := 7;
+ t := 7;
+ _ = t;
} else
count = count - t;
+ _ = t;
assertequal(count, -1, "if else false var outside");
}
diff --git a/test/interface/convert.go b/test/interface/convert.go
index f15f5ef..bc219c7 100644
--- a/test/interface/convert.go
+++ b/test/interface/convert.go
@@ -102,8 +102,7 @@
hello(t.String());
// I2T2 false
- var u1 U;
- u1, ok = s.(U);
+ _, ok = s.(U);
false(ok);
// I2I2 true
diff --git a/test/interface/fail.go b/test/interface/fail.go
index 0e0c4d3..07bd865 100644
--- a/test/interface/fail.go
+++ b/test/interface/fail.go
@@ -18,6 +18,7 @@
var e interface {};
e = s;
i = e.(I);
+ _ = i;
}
// hide S down here to avoid static warning
diff --git a/test/interface/pointer.go b/test/interface/pointer.go
index d94ec7c..be24952 100644
--- a/test/interface/pointer.go
+++ b/test/interface/pointer.go
@@ -30,7 +30,6 @@
}
func main() {
- re := new(Regexp);
print("call addinst\n");
var x Inst = AddInst(new(Start)); // ERROR "illegal|incompatible|is not"
print("return from addinst\n");
diff --git a/test/interface/receiver1.go b/test/interface/receiver1.go
index 7f257a3..8ce9642 100644
--- a/test/interface/receiver1.go
+++ b/test/interface/receiver1.go
@@ -27,17 +27,23 @@
v = t;
p = t; // ERROR "is not|requires a pointer"
+ _, _= v, p;
v = &t;
p = &t;
+ _, _= v, p;
v = s;
p = s; // ERROR "is not|requires a pointer"
+ _, _= v, p;
v = &s;
p = &s;
+ _, _= v, p;
v = sp;
p = sp; // no error!
+ _, _= v, p;
v = &sp;
p = &sp;
+ _, _= v, p;
}
diff --git a/test/ken/rob2.go b/test/ken/rob2.go
index 0e18b3b..518ba29 100644
--- a/test/ken/rob2.go
+++ b/test/ken/rob2.go
@@ -149,7 +149,6 @@
func NextToken()
{
var i, c int;
- var backslash bool;
tokenbuf[0] = nilchar; // clear previous token
c = Get();
@@ -222,8 +221,7 @@
func atom(i int) *Slist // BUG: uses tokenbuf; should take argument
{
- var h, length int;
- var slist, tail *Slist;
+ var slist *Slist;
slist = new(Slist);
if token == '0' {
diff --git a/test/ken/robif.go b/test/ken/robif.go
index 41d164c..b6fe4e4 100644
--- a/test/ken/robif.go
+++ b/test/ken/robif.go
@@ -21,56 +21,57 @@
count = 0;
if true {
- count = count + 1;
+ count = count + 1;
}
assertequal(count, 1, "if true");
count = 0;
if false {
- count = count + 1;
+ count = count + 1;
}
assertequal(count, 0, "if false");
count = 0;
if one := 1; true {
- count = count + one;
+ count = count + one;
}
assertequal(count, 1, "if true one");
count = 0;
if one := 1; false {
- count = count + 1;
+ _ = one;
+ count = count + 1;
}
assertequal(count, 0, "if false one");
count = 0;
if {
- count = count + 1;
+ count = count + 1;
}
assertequal(count, 1, "if empty");
count = 0;
if one := 1; {
- count = count + one;
+ count = count + one;
}
assertequal(count, 1, "if empty one");
count = 0;
if i5 < i7 {
- count = count + 1;
+ count = count + 1;
}
assertequal(count, 1, "if cond");
count = 0;
if true {
- count = count + 1;
+ count = count + 1;
} else
count = count - 1;
assertequal(count, 1, "if else true");
count = 0;
if false {
- count = count + 1;
+ count = count + 1;
} else
count = count - 1;
assertequal(count, -1, "if else false");
@@ -78,7 +79,8 @@
count = 0;
if t:=1; false {
count = count + 1;
- t := 7;
+ t := 7;
+ _ = t;
} else
count = count - t;
assertequal(count, -1, "if else false var");
@@ -87,7 +89,8 @@
t := 1;
if false {
count = count + 1;
- t := 7;
+ t := 7;
+ _ = t;
} else
count = count - t;
assertequal(count, -1, "if else false var outside");
diff --git a/test/ken/simpvar.go b/test/ken/simpvar.go
index 396ea7b..70946bf7 100644
--- a/test/ken/simpvar.go
+++ b/test/ken/simpvar.go
@@ -19,6 +19,7 @@
var x int;
x = 25;
y = 25;
+ _ = x;
}
x = x+y;
if(x != 40) { panic(x); }
diff --git a/test/literal.go b/test/literal.go
index 00b7b73..bd231ea 100644
--- a/test/literal.go
+++ b/test/literal.go
@@ -108,6 +108,7 @@
var u31 uint64 = 1;
var u32 uint64 = 18446744073709551615;
var u33 uint64 = +18446744073709551615;
+ _, _, _, _ = u30, u31, u32, u33;
// float
var f00 float = 3.14159;
@@ -192,6 +193,7 @@
assert(s1[4] == 0xc3, "s1-4");
assert(s1[5] == 0xb4, "s1-5");
var s2 string = "\a\b\f\n\r\t\v";
+ _, _ = s0, s2;
var s00 string = "\000";
var s01 string = "\007";
diff --git a/test/method.go b/test/method.go
index 6dba3d1..43408fe 100644
--- a/test/method.go
+++ b/test/method.go
@@ -33,7 +33,6 @@
var ps *S1;
var i I;
var pi *I1;
- var t T;
var pt *T1;
if s.val() != 1 { panicln("s.val:", s.val()) }
diff --git a/test/nil.go b/test/nil.go
index 1aef54b..d353096 100644
--- a/test/nil.go
+++ b/test/nil.go
@@ -32,4 +32,6 @@
i = nil;
ta = make([]IN, 1);
ta[0] = nil;
+
+ _, _, _, _, _, _, _, _ = i, f, s, m, c, t, in, ta;
}
diff --git a/test/stringrange.go b/test/stringrange.go
index 5d5b3a3..9215b95 100644
--- a/test/stringrange.go
+++ b/test/stringrange.go
@@ -15,7 +15,6 @@
func main() {
s := "\000\123\x00\xca\xFE\u0123\ubabe\U0000babe\U0010FFFFx";
expect := []int{ 0, 0123, 0, 0xFFFD, 0xFFFD, 0x123, 0xbabe, 0xbabe, 0x10FFFF, 'x' };
- var rune, size int;
offset := 0;
var i, c int;
ok := true;
diff --git a/test/switch.go b/test/switch.go
index f685420..835c900 100644
--- a/test/switch.go
+++ b/test/switch.go
@@ -73,37 +73,37 @@
case 6:
case 7:
case 8:
- case 9:
+ case 9:
default: assert(i5 == 5, "good");
}
switch i5 {
- case 0: dummy := 0; fallthrough;
- case 1: dummy := 0; fallthrough;
- case 2: dummy := 0; fallthrough;
- case 3: dummy := 0; fallthrough;
- case 4: dummy := 0; assert(false, "4");
- case 5: dummy := 0; fallthrough;
- case 6: dummy := 0; fallthrough;
- case 7: dummy := 0; fallthrough;
- case 8: dummy := 0; fallthrough;
- case 9: dummy := 0; fallthrough;
- default: dummy := 0; assert(i5 == 5, "good");
+ case 0: dummy := 0; _ = dummy; fallthrough;
+ case 1: dummy := 0; _ = dummy; fallthrough;
+ case 2: dummy := 0; _ = dummy; fallthrough;
+ case 3: dummy := 0; _ = dummy; fallthrough;
+ case 4: dummy := 0; _ = dummy; assert(false, "4");
+ case 5: dummy := 0; _ = dummy; fallthrough;
+ case 6: dummy := 0; _ = dummy; fallthrough;
+ case 7: dummy := 0; _ = dummy; fallthrough;
+ case 8: dummy := 0; _ = dummy; fallthrough;
+ case 9: dummy := 0; _ = dummy; fallthrough;
+ default: dummy := 0; _ = dummy; assert(i5 == 5, "good");
}
fired := false;
switch i5 {
- case 0: dummy := 0; fallthrough; // tests scoping of cases
- case 1: dummy := 0; fallthrough;
- case 2: dummy := 0; fallthrough;
- case 3: dummy := 0; fallthrough;
- case 4: dummy := 0; assert(false, "4");
- case 5: dummy := 0; fallthrough;
- case 6: dummy := 0; fallthrough;
- case 7: dummy := 0; fallthrough;
- case 8: dummy := 0; fallthrough;
- case 9: dummy := 0; fallthrough;
- default: dummy := 0; fired = !fired; assert(i5 == 5, "good");
+ case 0: dummy := 0; _ = dummy; fallthrough; // tests scoping of cases
+ case 1: dummy := 0; _ = dummy; fallthrough;
+ case 2: dummy := 0; _ = dummy; fallthrough;
+ case 3: dummy := 0; _ = dummy; fallthrough;
+ case 4: dummy := 0; _ = dummy; assert(false, "4");
+ case 5: dummy := 0; _ = dummy; fallthrough;
+ case 6: dummy := 0; _ = dummy; fallthrough;
+ case 7: dummy := 0; _ = dummy; fallthrough;
+ case 8: dummy := 0; _ = dummy; fallthrough;
+ case 9: dummy := 0; _ = dummy; fallthrough;
+ default: dummy := 0; _ = dummy; fired = !fired; assert(i5 == 5, "good");
}
assert(fired, "fired");
diff --git a/test/test0.go b/test/test0.go
index 9e20214..f42b12b 100644
--- a/test/test0.go
+++ b/test/test0.go
@@ -58,12 +58,14 @@
var p *Point = new(Point).Initialize(2, 3);
i := p.Distance();
var f float = 0.3;
+ _ = f;
for {}
for {};
for j := 0; j < i; j++ {
if i == 0 {
} else i = 0;
var x float;
+ _ = x;
}
foo: // a label
var j int;