Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
types: Prevent panic with uninitialized Number Value (#200)
Reference: #89 Reference: hashicorp/terraform-plugin-go#114 This change will ensure that if the `Number` `Value` pointer is `nil`, that the returned value is an untyped `nil`, rather than a `*big.Float` typed `nil`. The upstream `(tftypes.Value).IsNull()` method can only detect untyped `nil` for values. A related fix for `tftypes.NewValue()` to convert a `*big.Float` `nil` value into an untyped `nil` has also been merged upstream to fix this in depth. Previously, this new test case would pass: ```go "value-nil": { input: Number{Value: nil}, expectation: (*big.Float)(nil), }, ``` Now it appropriately expects: ```go "value-nil": { input: Number{Value: nil}, expectation: nil, }, ```
- Loading branch information