@@ -19,21 +19,23 @@ type EmbeddedStruct struct {
19
19
// Example provides a decent variety of types and features and
20
20
// lets us test for basic functionality in TinyGo.
21
21
type Example struct {
22
- Int64 int64 `msg:"int64"`
23
- Uint64 uint64 `msg:"uint64"`
24
- Int32 int32 `msg:"int32"`
25
- Uint32 uint32 `msg:"uint32"`
26
- Int16 int32 `msg:"int16"`
27
- Uint16 uint32 `msg:"uint16"`
28
- Int8 int32 `msg:"int8"`
29
- Byte byte `msg:"byte"`
30
- Float64 float64 `msg:"float64"`
31
- Float32 float32 `msg:"float32"`
32
- String string `msg:"string"`
33
- ByteSlice []byte `msg:"byte_slice"`
34
- StringSlice []string `msg:"string_slice"`
35
- IntArray [2 ]int `msg:"int_array"`
36
- SomeStruct SomeStruct `msg:"some_struct"`
22
+ Interface interface {} `msg:"interface"`
23
+ Any any `msg:"any"`
24
+ Int64 int64 `msg:"int64"`
25
+ Uint64 uint64 `msg:"uint64"`
26
+ Int32 int32 `msg:"int32"`
27
+ Uint32 uint32 `msg:"uint32"`
28
+ Int16 int32 `msg:"int16"`
29
+ Uint16 uint32 `msg:"uint16"`
30
+ Int8 int32 `msg:"int8"`
31
+ Byte byte `msg:"byte"`
32
+ Float64 float64 `msg:"float64"`
33
+ Float32 float32 `msg:"float32"`
34
+ String string `msg:"string"`
35
+ ByteSlice []byte `msg:"byte_slice"`
36
+ StringSlice []string `msg:"string_slice"`
37
+ IntArray [2 ]int `msg:"int_array"`
38
+ SomeStruct SomeStruct `msg:"some_struct"`
37
39
38
40
EmbeddedStruct
39
41
@@ -44,6 +46,8 @@ type Example struct {
44
46
45
47
// Setup populuates the struct with test data
46
48
func (e * Example ) Setup () {
49
+ e .Interface = 10
50
+ e .Any = "any"
47
51
e .Int64 = 10
48
52
e .Uint64 = 11
49
53
e .Int32 = 12
@@ -68,6 +72,12 @@ func (e *Example) Setup() {
68
72
}
69
73
70
74
func (e * Example ) Eq (e2 * Example ) bool {
75
+ if int64 (e .Interface .(int )) != e2 .Interface .(int64 ) {
76
+ return false
77
+ }
78
+ if e .Any .(string ) != e2 .Any .(string ) {
79
+ return false
80
+ }
71
81
if e .Int64 != e2 .Int64 {
72
82
return false
73
83
}
0 commit comments