cue
cue copied to clipboard
"compiler bug" when running a command with duplicate tags
I accidentally specified tag value twice and got this "compiler bug" error:
$ cue cmd -t who=me -t who=me hello
command.hello.print2.cmd: reference "who" set to unknown node in AST; this can result from incorrect API usage or a compiler bug:
./hello_tool.cue:11:22
exit status 1
This is a minor inconvenience but seems it is easy to check t.hasReplacement
in load.injectTags() and throw a helpful error message.
Would you mind providing a reproducer? See https://github.com/cue-lang/cue/wiki/Creating-test-or-performance-reproducers#creating-a-txtar-archive.
! exec cue cmd -t who=me -t who=me hello
cmp stderr stderr.golden
-- hello_tool.cue --
package hello
import "tool/exec"
who: string @tag(who)
command: hello: {
print2: exec.Run & {
cmd: "echo Hello \(who)!"
}
}
-- stderr.golden --
command.hello.print2.cmd: reference "who" set to unknown node in AST; this can result from incorrect API usage or a compiler bug:
./hello_tool.cue:6:24
Please ignore my suggestion to check t.hasReplacement
in load.injectTags
. Seems like cue eval
successfully handles duplicate tags during unification.
! exec cue eval -t who=me -t who=not-me hello.cue
cmp stderr stderr.golden
-- hello.cue --
who: string @tag(who)
message: "Hello \(who)!"
-- stderr.golden --
who: conflicting values "not-me" and "me"
who: invalid interpolation: conflicting values "not-me" and "me":
./hello.cue:2:10
Still appears to reproduce as of 12908b32a9a7.