From 7d339d27627de12e7dc99f823e84c381281babfc Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 3 Mar 2023 23:55:00 +0300 Subject: fix(tvix/eval): handle `__toString` when JSON-serialising attrsets These must be serialised to a JSON string of the *result* of coercing the function application to a string. Change-Id: Ib7f49ccd950503ddbdbf99643cd59565e26b50da Reviewed-on: https://cl.tvl.fyi/c/depot/+/8204 Reviewed-by: raitobezarius Tested-by: BuildkiteCI --- .../tvix_tests/eval-fail-builtins-tojson-tostring-notcallable.nix | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tvix/eval/src/tests/tvix_tests/eval-fail-builtins-tojson-tostring-notcallable.nix (limited to 'tvix/eval/src/tests/tvix_tests/eval-fail-builtins-tojson-tostring-notcallable.nix') diff --git a/tvix/eval/src/tests/tvix_tests/eval-fail-builtins-tojson-tostring-notcallable.nix b/tvix/eval/src/tests/tvix_tests/eval-fail-builtins-tojson-tostring-notcallable.nix new file mode 100644 index 000000000000..345b76fde037 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-fail-builtins-tojson-tostring-notcallable.nix @@ -0,0 +1,5 @@ +# attribute sets with a non-callable `__toString` can not be +# serialised to JSON. +builtins.toJSON { + __toString = 42; +} -- cgit 1.4.1