tvl-depot/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-getattr.nix
William Carroll 61cce49a8a feat(tvix/eval): Support builtins.getAttr
Support looking-up values from attrsets by their keys.

Change-Id: Ib37a472a511dab145f99ebc849879b3494e8e89f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6554
Reviewed-by: wpcarro <wpcarro@gmail.com>
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: wpcarro <wpcarro@gmail.com>
Tested-by: BuildkiteCI
2022-09-19 16:29:12 +00:00

6 lines
240 B
Nix

[
(builtins.getAttr "foo" { foo = 1; bar = 2; baz = 3; })
(builtins.getAttr "bar" { foo = 1; bar = 2; baz = 3; })
(builtins.getAttr "baz" { foo = 1; bar = 2; baz = 3; })
(builtins.getAttr "foo" { foo = { bar = { baz = 3; }; }; })
]