Commit f8d7f5bd authored by Ian Lance Taylor's avatar Ian Lance Taylor

Don't use a type guard with a type which is not an interface.

R=r,gri
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=18781
CL=18785
parent d5ba668e
...@@ -13,7 +13,7 @@ func main() { ...@@ -13,7 +13,7 @@ func main() {
i = 1; i = 1;
var v1 int = i; var v1 int = i;
if foo1(v1) != 1 { panicln(1) } if foo1(v1) != 1 { panicln(1) }
var v2 int32 = i.(int).(int32); var v2 int32 = int32(i.(int));
if foo2(v2) != 1 { panicln(2) } if foo2(v2) != 1 { panicln(2) }
var v3 int32 = i; // This implicit type conversion should fail at runtime. var v3 int32 = i; // This implicit type conversion should fail at runtime.
if foo2(v3) != 1 { panicln(3) } if foo2(v3) != 1 { panicln(3) }
......
...@@ -86,7 +86,7 @@ main() ...@@ -86,7 +86,7 @@ main()
u64 = 765432; ia[12] = u64; u64 = 765432; ia[12] = u64;
s = ia[0]; if s != "xxx" { panicln(0,s); } s = ia[0]; if s != "xxx" { panicln(0,s); }
i32 = ia[1].(int).(int32); i32 = int32(ia[1].(int));
if i32 != 12345 { panicln(1,i32); } if i32 != 12345 { panicln(1,i32); }
b = ia[2]; if b != true { panicln(2,b); } b = ia[2]; if b != true { panicln(2,b); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment