Skip to content
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

Inconsistency in allowed arguments to lpdf, lpmf, and _log functions #1045

Closed
WardBrian opened this issue Nov 18, 2021 · 0 comments · Fixed by #1046
Closed

Inconsistency in allowed arguments to lpdf, lpmf, and _log functions #1045

WardBrian opened this issue Nov 18, 2021 · 0 comments · Fixed by #1046
Labels
bug Something isn't working good first issue Good for newcomers typechecker

Comments

@WardBrian
Copy link
Member

WardBrian commented Nov 18, 2021

While reviewing #1044 @nhuurre discovered that these two functions are treated differently:

real foo_log(array[,] real x) {
  return sum(x[1]);
}
real foo_lpdf(array[,] real x) {
  return sum(x[1]);
}

Because UnsizedType.is_real_type doesn't check nested arrays, only 1-D ones.

I've asked @bob-carpenter and it seems the original intent was for any nested type to be possible, so the latter is the bug. Changing UnsizedType.is_real_type and UnsizedType.is_int_type should be the right thing to do here.

Additionally, there is nothing preventing a user from defining real foo_log(complex z) at the moment, which isn't possible for _lp[dm]f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers typechecker
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant