Skip to content

Commit

Permalink
Fix inlined arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
pelletier committed Sep 19, 2023
1 parent 52df481 commit ed749f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/serde/unsafe.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ func inlined(t reflect.Type) bool {
return true
case reflect.Struct:
return t.NumField() == 1 && inlined(t.Field(0).Type)
case reflect.Array:
return t.Len() == 1 && inlined(t.Elem())
default:
return false
}
Expand Down
2 changes: 2 additions & 0 deletions serde/serde_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ func TestReflect(t *testing.T) {

func() {},
func(int) int { return 42 },

[1]*int{intp},
}

for _, x := range cases {
Expand Down

0 comments on commit ed749f7

Please sign in to comment.