File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ func (s *stdSizes) Sizeof(T types.Type) int64 {
152
152
return align (offsets [n - 1 ]+ s .Sizeof (fields [n - 1 ].Type ()), maxAlign )
153
153
case * types.Interface :
154
154
return s .PtrSize * 2
155
- case * types.Pointer :
155
+ case * types.Pointer , * types. Chan , * types. Map :
156
156
return s .PtrSize
157
157
case * types.Signature :
158
158
// Func values in TinyGo are two words in size.
Original file line number Diff line number Diff line change @@ -175,6 +175,8 @@ func main() {
175
175
assertSize (reflect .TypeOf ("" ).Size () == unsafe .Sizeof ("" ), "string" )
176
176
assertSize (reflect .TypeOf (new (int )).Size () == unsafe .Sizeof (new (int )), "*int" )
177
177
assertSize (reflect .TypeOf (zeroFunc ).Size () == unsafe .Sizeof (zeroFunc ), "func()" )
178
+ assertSize (reflect .TypeOf (zeroChan ).Size () == unsafe .Sizeof (zeroChan ), "chan int" )
179
+ assertSize (reflect .TypeOf (zeroMap ).Size () == unsafe .Sizeof (zeroMap ), "map[string]int" )
178
180
179
181
// make sure embedding a zero-sized "not comparable" struct does not add size to a struct
180
182
assertSize (reflect .TypeOf (doNotCompare {}).Size () == unsafe .Sizeof (doNotCompare {}), "[0]func()" )
You can’t perform that action at this time.
0 commit comments