git.delta.rocks / jrsonnet / refs/heads / master

difftreelog

source

tests/golden_null_coalesce/null_coalesce_access.jsonnet431 Bsourcehistory
1// Test null-coalesce chained access: a?.b.c should return null when b is missing,2// not fail with "field c not found on null".34local obj = { a: { b: { c: 42 } } };56[7  // null-coalesce on missing field should return null, not error8  obj?.missing.b.c,910  // null-coalesce on present field continues11  obj?.a.b.c,1213  // null-coalesce with bracket index14  obj?.["missing"].b.c,1516  // chained null-coalesce17  obj?.a?.missing.c,18]