blob: e1187aef012f842cee01668a169c5cf2d7ae0252 [file] [log] [blame]
cue eval dup.cue
cmp stdout expect-stdout-cue
-- frontmatter.toml --
title = "Duplicate Fields"
description = ""
-- text.md --
CUE allows duplicated field definitions as long as they don't conflict.
For values of basic types this means they must be equal.
For structs, fields are merged and duplicated fields are handled recursively.
For lists, all elements must match accordingly
<!-- ([we discuss open-ended lists later](lists.md).) -->
-- dup.cue --
a: 4
a: 4
s: { b: 2 }
s: { c: 2 }
l: [ 1, 2 ]
l: [ 1, 2 ]
-- expect-stdout-cue --
a: 4
s: {
b: 2
c: 2
}
l: [1, 2]