BUG/MINOR: vars: truncate the variable name in error reports about scope.

When a variable starts with the wrong scope, it is named without stripping
the extra characters that follow it, which usually are closing parenthesis.
Let's make sure we only report what is expected.

This may be backported to 2.4.
1 file changed