Skip to content
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

reflect: Add Value.IsZero() method #3300

Merged
merged 1 commit into from
Nov 21, 2022
Merged

Conversation

juliaogris
Copy link
Contributor

@juliaogris juliaogris commented Nov 20, 2022

Add Value.IsZero() with tests, largely copied from the Go source code.

The tests were altered to remove the parts calling Zero() as that is
still unimplemented in tinygo, and to remove a test that tries to catch
a panic which is not supported on wasi.

A new case for UnsafePointer in Value.IsNil() was required for unsafe.Pointer tests to pass.

Link: https://cs.opensource.google/go/go/+/refs/tags/go1.19.3:src/reflect/value.go;l=1568
Link: https://cs.opensource.google/go/go/+/refs/tags/go1.19.3:src/reflect/all_test.go;l=1322
Co-authored-by: Cam Hutchison camh@xdna.net

Add Value.IsZero() with tests, largely copied from the Go source code.

The tests were altered to remove the parts calling `Zero()` as that is
still unimplemented in tinygo, and to remove a test that tries to catch
a panic which is not supported on wasi.

A new case for `UnsafePointer` in `Value.IsNil()` was required for
unsafe.Pointer tests to pass.

Link: https://cs.opensource.google/go/go/+/refs/tags/go1.19.3:src/reflect/value.go;l=1568
Link: https://cs.opensource.google/go/go/+/refs/tags/go1.19.3:src/reflect/all_test.go;l=1322
Co-authored-by: Cam Hutchison <camh@xdna.net>
Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@deadprogram
Copy link
Member

Thank you very much for the improvement @juliaogris and thanks @dgryski for reviewing. Now merging.

1 similar comment
@deadprogram
Copy link
Member

Thank you very much for the improvement @juliaogris and thanks @dgryski for reviewing. Now merging.

@deadprogram deadprogram merged commit c759e6f into tinygo-org:dev Nov 21, 2022
@deadprogram
Copy link
Member

Also thanks @camh-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants