stan-dev / stanc3

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

Remove unnecessary forward decls from MIR, code-gen appropriately #1298

Closed WardBrian closed 1 year ago

WardBrian commented 1 year ago

Submission Checklist

Release notes

Closes #1297 and fixes an issue where external functions could not be used in higher-order functions without the end-user supplying an implementation of our functor structs.

This uses code we already had since #1277 to remove "unnecessary" forward decls when we go from AST to MIR. This means all remaining forward decls in the MIR must be for external functions, so we can treat them as such later on.

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 commented 1 year ago

Huh, I pushed but my commits haven't shown up here. Odd

codecov[bot] commented 1 year ago

Codecov Report

Merging #1298 (5ba584f) into master (a490a09) will increase coverage by 0.05%. The diff coverage is 92.30%.

:exclamation: Current head 5ba584f differs from pull request most recent head 3732675. Consider uploading reports for the commit 3732675 to get more accurate results

@@            Coverage Diff             @@
##           master    #1298      +/-   ##
==========================================
+ Coverage   89.02%   89.08%   +0.05%     
==========================================
  Files          64       64              
  Lines        9752     9754       +2     
==========================================
+ Hits         8682     8689       +7     
+ Misses       1070     1065       -5     
Impacted Files Coverage Δ
src/middle/Program.ml 64.55% <ø> (ø)
src/stan_math_backend/Transform_Mir.ml 95.07% <88.09%> (+0.01%) :arrow_up:
src/frontend/Ast_to_Mir.ml 92.23% <100.00%> (+0.01%) :arrow_up:
src/frontend/Canonicalize.ml 96.45% <100.00%> (-0.17%) :arrow_down:
src/frontend/Deprecation_analysis.ml 92.30% <100.00%> (+0.55%) :arrow_up:
src/stan_math_backend/Lower_functions.ml 99.45% <100.00%> (+1.63%) :arrow_up:

... and 2 files with indirect coverage changes