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

tighter typing on local variables #2395

bob-carpenter opened this Issue Sep 11, 2017 · 0 comments


None yet
3 participants

bob-carpenter commented Sep 11, 2017


Right now, local variables are promoted to the return type of a function or the type of a block. But if they're data variables, this overpromotes.


We could lean lean on the data qualifiers in function declaration to help know that variables can safely be double or int.

Reproducible Steps:

For example,

real foo(real x, real y, real z) {
  real a = y^2 + z^2;

will declare the local variable for a using the return type of the function, which is the promotion of all three types, not just y's and z's.

Same situation with

model {
  real a = y^2 + z^2;

If y and z are data variables, then a can be declared as double.

Current Version:


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment