funtypes icon indicating copy to clipboard operation
funtypes copied to clipboard

ParsedValue in a union does not properly check the underlying type

Open swiftvimla opened this issue 3 years ago • 1 comments

Screenshot 2022-10-08 at 01 08 06

I ran this complete example in Quokka to show the output inline.

swiftvimla avatar Oct 07 '22 23:10 swiftvimla

If you want to use the ParsedValue in a union you need to either:

  1. Implement test.
  2. Ensure that serialize returns {success: false, value: ... } when the value is not valid.

We can't test the underlying value first when in serialize mode because we need the serialised value in order to test it against the underlying type.

ForbesLindesay avatar Sep 29 '23 12:09 ForbesLindesay