-
-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect error message when same identifier used for both fct name and var name #2621
Comments
Definitely a bug in the error message. We should be able to reuse the same term for a function name and variable, too. We'll look into it and fix. Thanks for reporting. |
Stanc3 now says
|
1. There's too much space around "foo" in this example.
2. Should we be quoting identifiers in error messages?
3. Should we say "column" rather than "characters"?
For instance, in clang++, this program:
int main() {
double foo;
double foo;
return 1;
}
produces this error:
cpperr.cpp:3:10: error: redefinition of 'foo'
double foo;
^
cpperr.cpp:2:10: note: previous definition is here
double foo;
^
1 error generated.
I'm not saying we need to go back to the original definition as this does!
The line numbers and columns aren't even marked, just 2:10 for line 2, column 10. I like that you're spelling it out.
- Bob
… On Dec 13, 2018, at 7:34 AM, Matthijs Vákár ***@***.***> wrote:
Stanc3 now says
Semantic error at file "test.stan", line 8, characters 7-10:
-------------------------------------------------
6: data { int<lower=0> N; vector[N] y; }
7: parameters {
8: real foo;
^
9: }
10: model {
-------------------------------------------------
Identifier foo is already in use.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thanks for the feedback! I agree. I've fixed points 1-3 in stanc3. |
Current message is:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary:
When the same identifier is used for both a fct name and var name, it misidentifies this as use of a reserved word.
Description:
I use "foo" as the name of a function in the functions block. Then I also use it as a parameter name in the parameters block. The error message says "variable identifier (name) may not be a reserved word", but "foo" is not a reserved word.
Reproducible Steps:
Current Output:
Expected Output:
I expect it to complain that "foo" is already being used as the name of a function.
Additional Information:
Current Version:
v2.17.3
The text was updated successfully, but these errors were encountered: