-
Notifications
You must be signed in to change notification settings - Fork 569
Support Go 1.16 reflect
package.
#996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
nevkontakte
merged 9 commits into
gopherjs:go1.16-stdlib
from
nevkontakte:go1.16-stdlib
Mar 16, 2021
Merged
Support Go 1.16 reflect
package.
#996
nevkontakte
merged 9 commits into
gopherjs:go1.16-stdlib
from
nevkontakte:go1.16-stdlib
Mar 16, 2021
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
flimzy
approved these changes
Mar 14, 2021
3384921
to
7949d55
Compare
flimzy
approved these changes
Mar 16, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't worry about comment typo corrections unless you're really bothered, or are making other changes anyway. It's still readable :)
`FuncForPC()` returns function/file/line metadata for any given code position (effectively a memory address). However, since GopherJS runtime doesn't have access to raw addresses, we emulate this by assigning virtual position counters for call places seen by Caller() and use them to retrieve the original function information. This is a more limited implementation that the upstream, but I expect it to work for most of the real-life cases, and it fixes a few test failures in the `reflect` package. With this it should be fairly easy to bring back proper support for `testing.T.Helper()` function. Co-authored-by: Jonathan Hall <flimzy@flimzy.com>
Previously we could return anything that may or may not have matched the required function signature, causing hard to debug failures in the code. This change replicates the upstream Go behavior.
In the upstream it is implemented in `runtime` and exported into `reflect` via a go:linkname directive, but GopherJS doesn't support that and we already define a local typeOffList in `reflect` as a substitute. Also delete it from reflectlite, since it isn't actually used there. Co-authored-by: visualfc <visualfc@gmail.com>
It has been introduced all the way back in Go 1.10, but GopherJS never properly supported it. The new implementation seems to pass most of the tests, which is an improvement. There are a couple of tests that are still failing, but fixing that seems like a harder task. The code is based on goplusjs/gopherjs@a293d52. Co-authored-by: visualfc <visualfc@gmail.com>
This reflects a change in the upstream intended to make use of terms "value" and "element" more consistent in the context of maps.
This commit is based on goplusjs/gopherjs@f4ae589 and goplusjs/gopherjs@143d71b. Co-authored-by: visualvc <visualfc@gmail.com>
eb79878
to
283ff62
Compare
flimzy
reviewed
Mar 16, 2021
The original test was using a signalling NaN, but JavaScript appears to coerce all NaNs to quiet ones. I found no mention of this behavior in the spec, but I suspect it is just the behavior JavaScript historically implemented when dealing with NaNs. Co-authored-by: Jonathan Hall <flimzy@flimzy.com>
Several `reflect` tests rely on it to execute correctly.
flimzy
approved these changes
Mar 16, 2021
`go generate ./...`
aa92048
to
44fa453
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request addresses multiple issues that were causing test failures for the
reflect
package.MakeFunc()
function.StructOf()
function.See individual commit messages for more details.
Updates #992.