Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1195)

Issue 78500044: code review 78500044: reflect: fixed bug introduced with change 6c0339d94123.

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 1 month ago by mpvl
Modified:
10 years ago
Reviewers:
rsc, cmang, gri, iant
CC:
golang-codereviews, r
Visibility:
Public.

Description

reflect: fixed bug introduced with change 66510044. A struct may contain embedded unexported structs which, in turn, contains exported fields. According to the Go spec, fields that are promoted from an embedded struct are treated as ordinary fields. So exported fields in such a struct should be exported in the embedding struct as well. Go handles this correctly. The reflect package should and did handle this analoguously. The aforementioned change broke this. The changes in this CL to the reflect package fix this again. CanSet will still be false for a anonymous field with an unexported struct, but it will be true for values of exported fields within such a struct. This change also changed the semantics of PkgPath. Several packages relied on PkgPath != "" to mean that a field no longer needs to be searched for unexported fields. This is no longer the case. This CL includes fixes for the xml and json package. I didn't see similar cases in core, but I suspect there are others out there. Fixes Issue 7522.

Patch Set 1 #

Patch Set 2 : diff -r 6c0339d94123 https://code.google.com/p/go #

Patch Set 3 : diff -r 321d42ff40d3 https://code.google.com/p/go #

Patch Set 4 : diff -r 321d42ff40d3 https://code.google.com/p/go #

Total comments: 4

Patch Set 5 : diff -r 0134c7020c40 https://code.google.com/p/go #

Patch Set 6 : diff -r 0134c7020c40 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+216 lines, -8 lines) Patch
M src/pkg/encoding/json/decode_test.go View 1 2 5 chunks +14 lines, -2 lines 0 comments Download
M src/pkg/encoding/json/encode.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/encoding/xml/marshal_test.go View 1 2 4 chunks +10 lines, -0 lines 0 comments Download
M src/pkg/encoding/xml/typeinfo.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/reflect/all_test.go View 1 2 3 4 5 4 chunks +175 lines, -0 lines 0 comments Download
M src/pkg/reflect/value.go View 1 2 3 4 5 7 chunks +15 lines, -4 lines 0 comments Download

Messages

Total messages: 13
mpvl
Hello rsc@golang.org, iant@golang.org, gri@golang.org, cmang@golang.org (cc: golang-codereviews@googlegroups.com, r@golang.org), I'd like you to review this change ...
10 years, 1 month ago (2014-03-21 11:56:00 UTC) #1
mpvl
Hello rsc@golang.org, iant@golang.org, gri@golang.org, cmang@golang.org (cc: golang-codereviews@googlegroups.com, r@golang.org), Please take another look.
10 years, 1 month ago (2014-03-21 12:01:41 UTC) #2
rsc
thanks. will look more closely tomorrow.
10 years, 1 month ago (2014-03-25 00:52:50 UTC) #3
mpvl
Hi Russ, Thanks for looking in to this. There are quite a few nuances to ...
10 years, 1 month ago (2014-03-25 09:56:01 UTC) #4
rsc
I support the intent of this change but I think the code is not quite ...
10 years ago (2014-04-08 15:41:05 UTC) #5
mpvl
Good point. Will work on a solution and add more thorough tests as well. There ...
10 years ago (2014-04-10 22:21:32 UTC) #6
rsc
We need this by Monday for the first beta, ideally. If you'd like me to ...
10 years ago (2014-04-11 02:55:11 UTC) #7
mpvl
I did make some progress today. I added some tests to cover a bunch of ...
10 years ago (2014-04-11 03:09:19 UTC) #8
mpvl
Would like to go over the code a bit more tomorrow, but you might want ...
10 years ago (2014-04-11 03:09:21 UTC) #9
rsc
I've been on the fence, but now I'm convinced. We can't have this ready in ...
10 years ago (2014-04-11 04:00:04 UTC) #10
rsc
The rollback is https://codereview.appspot.com/85580046/.
10 years ago (2014-04-11 04:07:25 UTC) #11
rsc
R=close Let's pick this up in 1.4. (hg mail will reopen then.)
10 years ago (2014-04-17 02:52:58 UTC) #12
mpvl
10 years ago (2014-04-17 22:10:48 UTC) #13
Sounds good.


On Wed, Apr 16, 2014 at 7:52 PM, <rsc@golang.org> wrote:

> R=close
>
> Let's pick this up in 1.4. (hg mail will reopen then.)
>
>
> https://codereview.appspot.com/78500044/
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b