Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
internal/core/adt: allow hidden fields alongside embedded lists
Browse files Browse the repository at this point in the history
Fixes #794

Change-Id: Idf9f342347563ea5be19c84004586a4df30b02b8
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/8921
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
mpvl committed Mar 6, 2021
1 parent e4d0d13 commit 79644c3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions cue/testdata/scalars/embed.txtar
Expand Up @@ -93,6 +93,13 @@ optionalCheck: {
other: 3
}
}

hidden: {
issue794: {
_foo: "foo"
[_foo]
}
}
-- out/eval --
Errors:
listEmbed.b6: invalid list index 5 (out of bounds):
Expand Down Expand Up @@ -194,6 +201,12 @@ Result:
other: (int){ 3 }
}
}
hidden: (struct){
issue794: (#list){
_foo: (string){ "foo" }
0: (string){ "foo" }
}
}
}
-- out/compile --
--- in.cue
Expand Down Expand Up @@ -301,4 +314,12 @@ Result:
other: 3
}
}
hidden: {
issue794: {
_foo: "foo"
[
〈0;_foo〉,
]
}
}
}
2 changes: 1 addition & 1 deletion internal/core/adt/context.go
Expand Up @@ -743,7 +743,7 @@ func (c *OpContext) lookup(x *Vertex, pos token.Pos, l Feature, state VertexStat
return nil
}

case l.IsDef():
case l.IsDef(), l.IsHidden():

default:
c.addErrf(0, pos, "invalid list index %s (type string)", l)
Expand Down

0 comments on commit 79644c3

Please sign in to comment.