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

Allow existing uses of _jacobian in function names, with warning #1471

Merged
merged 3 commits into from
Nov 26, 2024

Conversation

WardBrian
Copy link
Member

Closes #1470. This uses the basic rule that if the functions block contains no uses of the new jacobian += statement, it is probably older code, so we should keep allowing it for now.

Submission Checklist

  • Run unit tests
  • Documentation
    • If a user-facing facing change was made, the documentation PR is here:
    • OR, no user-facing changes were made

Release notes

Fixed a backwards-compatiblity hazard with the new _jacobian functions. Existing functions that just happen to have this naming structure will no longer fail to compile, but will issue a warning alerting that this name will change meanings in the future.

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)

@WardBrian WardBrian requested a review from nhuurre November 26, 2024 16:34
Copy link
Collaborator

@nhuurre nhuurre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

In unrelated news, the following error is not detected until C++ compilation:

functions {
  // void function
  void foo_jacobian() {
    jacobian += 1;
  }
}
transformed data {
  foo_jacobian();
}

@WardBrian
Copy link
Member Author

@nhuurre good catch! so did this:

functions {
    void foo_rng(real x){
        print(normal_rng(0,x));
    }
}

model {
    foo_rng(1.0);
}

Fixed both.

@WardBrian WardBrian requested a review from nhuurre November 26, 2024 17:20
Copy link
Collaborator

@nhuurre nhuurre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

void rngs are useless, but I suppose there's no harm in allowing them.

Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 66.00000% with 17 lines in your changes missing coverage. Please review.

Project coverage is 89.67%. Comparing base (96e409a) to head (02c8663).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
src/frontend/Deprecation_analysis.ml 62.22% 17 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1471      +/-   ##
==========================================
- Coverage   89.76%   89.67%   -0.10%     
==========================================
  Files          63       63              
  Lines       10613    10656      +43     
==========================================
+ Hits         9527     9556      +29     
- Misses       1086     1100      +14     
Files with missing lines Coverage Δ
src/frontend/Typechecker.ml 93.05% <100.00%> (+0.27%) ⬆️
src/middle/Fun_kind.ml 90.90% <100.00%> (ø)
src/frontend/Deprecation_analysis.ml 72.63% <62.22%> (-9.37%) ⬇️

@WardBrian WardBrian merged commit 8d74ceb into master Nov 26, 2024
3 checks passed
@WardBrian WardBrian deleted the fix/1470-underscore-jacobian-bwd-compat branch November 26, 2024 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants