-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
stan parser: disallow transpose operator on primitive type variables #2594
Comments
If I try to compile
with stanc3, it tells me
|
I think this is OK as an error message here.
Is there a way to get the caret to point at "'" rather than "1"?
… On Dec 13, 2018, at 7:44 AM, Matthijs Vákár ***@***.***> wrote:
If I try to compile
model {
print(1.0');
}
with stanc3, it tells me
Semantic error at file "test.stan", line 2, characters 8-12:
-------------------------------------------------
1: model {
2: print(1.0');
^
3: }
-------------------------------------------------
Ill-typed arguments supplied to postfix operator '. Available signatures:
(matrix) => matrix
(row_vector) => vector
(vector) => row_vector
Instead supplied argument of incompatible type: real.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Not an easy way, I think. Currently, start and end locations are only carried around for expressions, statements and identifiers. Operators do not fall into those categories. The error location currently being used is that of the expression 1.0' (specifically its start location). |
I think it's more conventional to point at the end of a problematic expression. Compare the C++ behavior:
The error message is:
And for this,
we get
|
Summary:
parser allows transpose of primitives in program - it would be better to flag this and fail.
Description:
noticed during code review as part of #2498
Reproducible Steps:
Please report steps to reproduce the issue. If it's not possible to reproduce, please include a description of how you discovered the issue.
If you have a reproducible example, please include it.
Current Output:
The current output. Knowing what is the current behavior is useful.
Expected Output:
Describe what you expect the output to be. Knowing the correct behavior is also very useful.
Additional Information:
Provide any additional information here.
Current Version:
v2.18.0
The text was updated successfully, but these errors were encountered: