-
Notifications
You must be signed in to change notification settings - Fork 94
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
Implement reflect.OutOf #39
Conversation
Misc changes: * Stub out support for maps * Export the recursion functions so they can be tested from reflect_test * Separate out our number types so they can be associated with different attr.Types (still not sure if this is a good idea or a mistake) * Stop using `reflect.Value.Interface()`, because it forces us to assert a type, which will break on type aliases. Instead, use the `reflect.Value` methods that return strongly-typed primitives, making the reflect package handle the conversion for us. * Call `tftypes.ValidateValue` before calling `tftypes.NewValue` so we error instead of panicking. * Stop using `trueReflectValue` and handle things at every layer. * Add support for floats. * Reuse the `getStructTags` helper instead of reimplementing it * Recurse into `OutOf` instead of reimplementing the switch inside `FromStruct` * Accept an `interface{}` instead of a `reflect.Value`, letting callers ignore the involvement of the `reflect` package. Also, have our helpers take strongly-typed parameters instead of `reflect.Value`s, simplifying them.
Separate out into/outof into their own files, for ease of reading. Stop pulling types out of OutOfOptions, instead preferring to pass in the complete type information ahead of time. Add support for slices, maps, pointers. Stub out and TODO support for interfaces.
bf830bc
to
1763089
Compare
I think this is now ready for review. It has a good amount of test coverage, and seems to be able to do what we want from it, which is generating an |
Ready for another review pass, I think. |
Excellent! I hereby approve the latest changes (I can't mark the PR approved as I'm the author). |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Implement
reflect.OutOf
.