ytt icon indicating copy to clipboard operation
ytt copied to clipboard

confusing error message when overlay/match expects is not quoted

Open dprotaso opened this issue 4 years ago • 1 comments

---
id: 1
type: book
modified: false
---
id: 2
type: book
modified: false
---
id: 3
type: course
modified: false
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.all, expects=1+
---
modified: true

Gives you the error message

- got ')', want primary expression
    match-subset-docs.yml:2 | #@overlay/match by=overlay.all, expects=1+

What's confusing is that there isn't a ) in the annotation that I wrote.

I was hoping it would print an error saying my expects input should be quoted. Or ideally it accepts the 1+ as a valid token (ie. without the quoting)

dprotaso avatar Apr 11 '21 17:04 dprotaso

yeah, that's an interesting one to fix. i think best we case scenario here is to figure out how to make error msg more understandable but even that would be hard.

#@overlay/match by=overlay.all, expects=1+

gets turned into something like

capture_annotation("overlay/match", by=overlay.all, expects=1+)

which in plain starlark is invalid since + operation is expecting a second operand before function brace closes.

cppforlife avatar Apr 14 '21 23:04 cppforlife