The following code:
'''
template("foo") {
assert(target_name != "")
forward_variables_from(invoker, [ "baz" ])
}
foo("bar") {
baz = "baz"
assert(baz != "")
}
'''
will produce the following error:
'''
ERROR at //BUILD.gn:7:9: Assignment had no effect.
baz = "baz"
^----
You set the variable "baz" here and it was unused before it went
out of scope.
'''
This is because "baz" is forwarded into the "foo" template, but unused there. However, the error message points to the "bar" invoker, where "baz" is in fact used. This is a very confusing message.
See the attached minimal repro project.
|
Deleted:
unused.tar.bz2
571 bytes
|
Comment 1 by rnimmagadda@chromium.org
, Aug 9 2016