New issue
Advanced search Search tips

Issue 618866 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 395883
Owner: ----
Closed: Aug 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

Misleading "assignment had no effect" error message when forwarding vars

Project Member Reported by paulmiller@chromium.org, Jun 9 2016

Issue description

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.
 
unused.tar.bz2
571 bytes Download
Components: Build

Comment 2 by brettw@chromium.org, Aug 10 2016

Mergedinto: 395883
Status: Duplicate (was: Untriaged)

Sign in to add a comment