stan-dev / stanc3

The Stan transpiler (from Stan to C++ and beyond).
BSD 3-Clause "New" or "Revised" License
138 stars 44 forks source link

Validate the dimensionality of variables in transform_inits #1316

Closed WardBrian closed 1 year ago

WardBrian commented 1 year ago

Submission Checklist

Release notes

Closes #1315. The shapes and sizes of parameter initial values are now checked against the specified sizes in the model before being read in, matching the existing behavior for data.

Note: This change may cause existing code which worked "by accident" to raise new errors about mismatches between the model's declarations and the provided initialization.

Errors in transform_inits should now properly highlight the location in the original Stan program.

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)

codecov[bot] commented 1 year ago

Codecov Report

Merging #1316 (b85b797) into master (2081cb6) will increase coverage by 0.00%. The diff coverage is 96.25%.

@@           Coverage Diff           @@
##           master    #1316   +/-   ##
=======================================
  Coverage   89.01%   89.02%           
=======================================
  Files          64       64           
  Lines        9777     9791   +14     
=======================================
+ Hits         8703     8716   +13     
- Misses       1074     1075    +1     
Impacted Files Coverage Δ
src/analysis_and_optimization/Optimize.ml 92.58% <ø> (ø)
src/stan_math_backend/Lower_functions.ml 99.45% <ø> (ø)
src/middle/Program.ml 67.12% <71.42%> (ø)
src/analysis_and_optimization/Mir_utils.ml 77.53% <80.00%> (ø)
...c/analysis_and_optimization/Dependence_analysis.ml 100.00% <100.00%> (ø)
...rc/analysis_and_optimization/Monotone_framework.ml 91.20% <100.00%> (ø)
src/analysis_and_optimization/Partial_evaluator.ml 89.32% <100.00%> (ø)
src/frontend/Ast_to_Mir.ml 92.25% <100.00%> (+0.03%) :arrow_up:
src/stan_math_backend/Lower_program.ml 99.07% <100.00%> (+0.02%) :arrow_up:
src/stan_math_backend/Numbering.ml 100.00% <100.00%> (ø)
... and 1 more

... and 1 file with indirect coverage changes