mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Per discussion earlier today with r and gri: when an interface
object has a value of type "int", it should not automatically convert to type "int32". That is, the type alias "int" should be regarded as having been defined as though "type int int32" appeared outside of the package, and as therefore being a different type from "int32". R=ken DELTA=21 (20 added, 0 deleted, 1 changed) OCL=17587 CL=17842
This commit is contained in:
parent
a785e8ac6d
commit
22a6747999
3 changed files with 25 additions and 1 deletions
|
|
@ -86,7 +86,8 @@ main()
|
|||
u64 = 765432; ia[12] = u64;
|
||||
|
||||
s = ia[0]; if s != "xxx" { panicln(0,s); }
|
||||
i32 = ia[1]; if i32 != 12345 { panicln(1,i32); }
|
||||
i32 = ia[1].(int).(int32);
|
||||
if i32 != 12345 { panicln(1,i32); }
|
||||
b = ia[2]; if b != true { panicln(2,b); }
|
||||
|
||||
s = ia[3]; if s != "now is" { panicln(3,s); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue