diff options
8 files changed, 38 insertions, 4 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index a2136ee6ad05..b19ba7009f2f 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -523,7 +523,7 @@ mod pure_builtins { async fn builtin_gen_list( co: GenCo, // Nix 2.3 doesn't propagate failures here - #[catch] generator: Value, + #[lazy] generator: Value, length: Value, ) -> Result<Value, ErrorKind> { let mut out = imbl::Vector::<Value>::new(); @@ -905,7 +905,7 @@ mod pure_builtins { } #[builtin("map")] - async fn builtin_map(co: GenCo, #[catch] f: Value, list: Value) -> Result<Value, ErrorKind> { + async fn builtin_map(co: GenCo, #[lazy] f: Value, list: Value) -> Result<Value, ErrorKind> { let mut out = imbl::Vector::<Value>::new(); // the best span we can get… @@ -920,7 +920,11 @@ mod pure_builtins { } #[builtin("mapAttrs")] - async fn builtin_map_attrs(co: GenCo, f: Value, attrs: Value) -> Result<Value, ErrorKind> { + async fn builtin_map_attrs( + co: GenCo, + #[lazy] f: Value, + attrs: Value, + ) -> Result<Value, ErrorKind> { let attrs = attrs.to_attrs()?; let mut out = imbl::OrdMap::new(); diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-genList-function-strictness.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-genList-function-strictness.exp new file mode 100644 index 000000000000..06712ebc33e4 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-genList-function-strictness.exp @@ -0,0 +1 @@ +[ <LAMBDA> 0 1 2 ] diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-genList-function-strictness.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-genList-function-strictness.nix new file mode 100644 index 000000000000..e161e3b4af4f --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-genList-function-strictness.nix @@ -0,0 +1,8 @@ +let + self = + let + l = builtins.genList (builtins.head self) 3; + in + [ (x: x) ] ++ l; +in +self diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-map-function-strictness.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-map-function-strictness.exp new file mode 100644 index 000000000000..050c2c4de51f --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-map-function-strictness.exp @@ -0,0 +1 @@ +[ <LAMBDA> 2 "." 18 "https://github.com/NixOS/nix/issues/9779" "-.-" ] diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-map-function-strictness.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-map-function-strictness.nix new file mode 100644 index 000000000000..932d3d0eaebc --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-map-function-strictness.nix @@ -0,0 +1,8 @@ +let + self = + let + l = builtins.map (builtins.head self) [ 2 "." 18 https://github.com/NixOS/nix/issues/9779 "-.-" ]; + in + [ (x: x) ] ++ l; +in +self diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mapAttrs-function-strictness.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mapAttrs-function-strictness.exp new file mode 100644 index 000000000000..7e70748ffd6f --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mapAttrs-function-strictness.exp @@ -0,0 +1 @@ +{ a = 1; b = 2; f = <LAMBDA>; } diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mapAttrs-function-strictness.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mapAttrs-function-strictness.nix new file mode 100644 index 000000000000..2946d6de1760 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-mapAttrs-function-strictness.nix @@ -0,0 +1,8 @@ +let + self = + let + s = builtins.mapAttrs self.f { a = 1; b = 2; }; + in + { f = _: x: x; } // s; +in +self diff --git a/tvix/verify-lang-tests/default.nix b/tvix/verify-lang-tests/default.nix index 276a57f12935..772c1c532078 100644 --- a/tvix/verify-lang-tests/default.nix +++ b/tvix/verify-lang-tests/default.nix @@ -76,11 +76,14 @@ let # b72bc4a972fe568744d98b89d63adcd504cb586c "eval-okay-identifier-formatting.nix" = [ nix ]; - # Different catchable behavior between nix 2.3 and 2.18 + # Differing strictness in the function argument for some builtins in Nix 2.18 + # https://github.com/NixOS/nix/issues/9779 "eval-okay-builtins-map-propagate-catchable.nix" = [ nix_latest ]; "eval-okay-builtins-gen-list-propagate-catchable.nix" = [ nix_latest ]; "eval-okay-builtins-replace-strings-propagate-catchable.nix" = [ nix_latest ]; + "eval-okay-builtins-map-function-strictness.nix" = [ nix_latest ]; + "eval-okay-builtins-genList-function-strictness.nix" = [ nix_latest ]; # TODO(sterni): support diffing working directory and home relative paths # like C++ Nix test suite (using string replacement). |