reason
reason copied to clipboard
better error message for empty string in objects
Moved from https://github.com/BuckleScript/bucklescript/issues/3494
It would be nice that reason do some sanity check in the first place.
Defining a Js.t object such as let obj = {"": someValue}; throws the following for me:
Fatal error: exception File "lam_methname.ml", line 135, characters 2-8: Assertion failed
File "", line 1:
Error: Error while running external preprocessor
I encountered the problem while trying to define an xstate transient transition which gives special meaning to the empty string key.
Side note: Putting the Js.t example above on the "Try Reason" website currently causes the site to completely crash.
This works OK in Reason:
$ echo 'let obj = {"": someValue};' | ./_build/install/default/bin/refmt
let obj = {"": someValue};
Looks like the stack trace is referring to BuckleScript internals.
Ah, I am suggesting reason do a sanity check
Do you think this needs to be reopened? Could you explain better what you had in mind for a sanity check?
Does that mean we shouldn't support objects with empty keys?
relevant to https://github.com/BuckleScript/bucklescript/issues/3494 may need some discussion with the proper behavior with empty string