-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Fix issue with function shadowing #1011
Conversation
@SteveBronder this seems mostly good except for a few functions which aren't fully in stan-math: stanc3/src/stan_math_backend/Expression_gen.ml Lines 294 to 308 in 4a87f0f
But it still doesn't catch all cases Any thoughts? |
Seems like |
I think this is the way to go + a model in the tests somewhere with all the calls to these functions? If you can make an issue in Math with a list of the missing ones I can handle it tomorrow I think. |
Thanks @rok-cesnovar, see here: stan-dev/math#2611 We currently have models in test/integration/function-signatures/math/functions which should test these. They're what is failing in the above tests for the most part |
Oh yeah, the tests are there. Should be ready by the time you start work tomorrow :) |
I should note for posterity's sake that the alternative to this change (qualifying everything not in userspace with it's namespace) is to mangle everything from userspace, which could reuse the machinery from #962 I personally lean toward this solution as it leaves the C++ easier to read, IMO |
I believe I have run down every compilation issue that isn't a result of the stan-math signatures @rok-cesnovar. When that PR gets merged this should be green, but we could also try to test before that to make sure |
Started a run with the Math PR branch: https://jenkins.mc-stan.org/blue/organizations/jenkins/stanc3/detail/PR-1011/39/pipeline/ |
@rok-cesnovar I don't understand the failures in that run. It claims that hearts.stan from the bugs example models generates code with a |
Okay, we define overloads of operators in stan::math, so my plan to completely remove the That doesn't seem like 100% of the issues but we will start there |
Oh man, that test isn't actually doing what we (or at least I) thought it should be doing. It was originally thought of as a comparison with stanc2. It's currently just comparing nightly with nightly. And its not trivial to force ./compare-compiler.sh to do what it should (compare nightly with PR stanc3 binary). Do you mind if we remove the test and make an issue? |
Sure, it seems like this PR has some other issues to sort out in the meantime anyway |
@serban-nicusor-toptal - now getting a weird failure during verify changes https://jenkins.mc-stan.org/blue/organizations/jenkins/stanc3/detail/PR-1011/43/pipeline |
Looks like a permission issue, checking. |
@rok-cesnovar - still a problem with
|
Hm, that would be complex pow. Ok, that i didnt actually account for in my PR. |
@rok-cesnovar this still needs math changes right? #1067 isn't enough? |
Yeah, pow(complex) and friends are missing for primitive inputs. Sorry, was a busy week and havent gotten back to this. |
No worries, just wanted to ask before trying to run the tests again! |
All models compiled 🎉 Finally. |
@rok-cesnovar what's the necessary merge order between this and the stan-math PR? |
stanc3 PR should be merged first and then the Math one should be merged as soon as possible. No other Math/Stan/Cmdstan PR will pass between merging the stanc3 PR and the Math PR. The Math PR is ready, it won't pass the upstream tests until we merge this PR. The next step would be to get both PRs approved then I can handle the merging procedure. |
@SteveBronder would you be able to review this? It's not a super complicated change on this end |
If Steve is not available or busy, happy to review this one. This is in my Ocaml/stanc3 comfort zone :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. One minor comment on the special casing operators.
All good. Now we need the Math PR approved and we should be good to go. |
Closes #997.
This PR moves to qualifying all non-user functions with either
stan::math
orstan::model
as appropriate. This means that the C++ will compile even if the user defines a variable of the same name.Submission Checklist
Release notes
Fixed an issue that arose during C++ compilation of models that used a variable with the same name as a Stan library function and called that function.
Copyright and Licensing
By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the BSD 3-clause license (https://opensource.org/licenses/BSD-3-Clause)