diff --git a/reflect_optional.go b/reflect_optional.go index 43ec71d..fa71f47 100644 --- a/reflect_optional.go +++ b/reflect_optional.go @@ -2,7 +2,6 @@ package jsoniter import ( "github.com/modern-go/reflect2" - "reflect" "unsafe" ) @@ -10,9 +9,6 @@ func decoderOfOptional(ctx *ctx, typ reflect2.Type) ValDecoder { ptrType := typ.(*reflect2.UnsafePtrType) elemType := ptrType.Elem() decoder := decoderOfType(ctx, elemType) - if ctx.prefix == "" && elemType.Kind() == reflect.Ptr { - return &dereferenceDecoder{elemType, decoder} - } return &OptionalDecoder{elemType, decoder} } diff --git a/type_tests/map_key_test.go b/type_tests/map_key_test.go index e5bd21f..e3cfe38 100644 --- a/type_tests/map_key_test.go +++ b/type_tests/map_key_test.go @@ -1,3 +1,6 @@ +// +build !go1.14 +// remove these tests temporarily until https://github.com/golang/go/issues/39105 is fixed + package test import ( diff --git a/type_tests/struct_tags_test.go b/type_tests/struct_tags_test.go index 66834b8..ae4b80f 100644 --- a/type_tests/struct_tags_test.go +++ b/type_tests/struct_tags_test.go @@ -121,10 +121,11 @@ func init() { F1 int32 `json:"F1"` F2 int32 `json:"F2,string"` })(nil), - (*struct { - F1 string `json:"F1"` - F2 string `json:"F2,string"` - })(nil), + // remove temporarily until https://github.com/golang/go/issues/38126 is fixed + // (*struct { + // F1 string `json:"F1"` + // F2 string `json:"F2,string"` + // })(nil), (*struct { F1 uint8 `json:"F1"` F2 uint8 `json:"F2,string"` diff --git a/value_tests/ptr_114_test.go b/value_tests/ptr_114_test.go new file mode 100644 index 0000000..43c51d5 --- /dev/null +++ b/value_tests/ptr_114_test.go @@ -0,0 +1,15 @@ +// +build go1.14 + +package test + +func init() { + unmarshalCases = append(unmarshalCases, unmarshalCase{ + obj: func() interface{} { + var i int + pi := &i + ppi := &pi + return &ppi + }, + input: "null", + }) +} diff --git a/value_tests/ptr_test.go b/value_tests/ptr_test.go index 222b2d4..90d3a03 100644 --- a/value_tests/ptr_test.go +++ b/value_tests/ptr_test.go @@ -27,13 +27,5 @@ func init() { return &pi }, input: "null", - }, unmarshalCase{ - obj: func() interface{} { - var i int - pi := &i - ppi := &pi - return &ppi - }, - input: "null", }) }