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

Ensure return statements use local_scalar_t #1335

Closed WardBrian closed 11 months ago

WardBrian commented 11 months ago

Closes #1334.

The solution here was to update the typechecker to promote arrays in the return position to fix this issue. Scalars and Eigen types happily promote from double to var, so it was really only an issue for std::vectors.

Submission Checklist

Release notes

Fixed an issue where returning array literals could produce the wrong types in C++.

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 11 months ago

Codecov Report

Merging #1335 (9c4bb5e) into master (5662625) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1335   +/-   ##
=======================================
  Coverage   88.76%   88.77%           
=======================================
  Files          64       64           
  Lines        9865     9873    +8     
=======================================
+ Hits         8757     8765    +8     
  Misses       1108     1108           
Impacted Files Coverage Δ
src/frontend/Typechecker.ml 89.77% <100.00%> (+0.08%) :arrow_up: