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

More consistently print requested file name in errors #1274

Closed WardBrian closed 1 year ago

WardBrian commented 1 year ago

Submission Checklist

Release notes

Improved --filename-in-msg for the command line version of stanc. Errors now use the requested name, not just warnings.

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 #1274 (694f3a2) into master (e7d5dc3) will increase coverage by 0.01%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1274      +/-   ##
==========================================
+ Coverage   88.47%   88.49%   +0.01%     
==========================================
  Files          63       63              
  Lines        9262     9262              
==========================================
+ Hits         8195     8196       +1     
+ Misses       1067     1066       -1     
Impacted Files Coverage Δ
src/middle/Location.ml 94.87% <100.00%> (+1.20%) :arrow_up:
src/stanc/stanc.ml 84.16% <100.00%> (+0.13%) :arrow_up:
WardBrian commented 1 year ago

@nhuurre good catch - that behavior also isn't tested! I've added a test and changed it so that the argument only affects the top-level name (e.g. the file passed on the command line), rather than all of them.

For context, I'm particularly interested in this for things like https://github.com/ivan-bocharov/stan-vscode/pull/11, which sometimes needs to run the compiler on a temporary file. It's nice to print the original name in the error if so.

nhuurre commented 1 year ago

Thanks, but the docstring needs to change too.