JuliaLang / JuliaSyntax.jl

The Julia compiler frontend
Other
272 stars 35 forks source link

Fix diagnostics printing when `pwd()` doesn't exist #373

Closed c42f closed 11 months ago

c42f commented 11 months ago

Computing the file URL for pretty printing using abspath can fail when the current working directory doesn't exist. This is a quick fix for this issue (which is incredibly confusing/disruptive if the user does manage to enter a nonexistant working directory!)

A more complete fix would avoid ever looking at the working directory when printing diagnostics, instead requiring the caller to pass in a richer definition of the "location of source code" than the mere file name as a string. However getting something sensible working there is (a) breaking and (b) unclear on may details. So just patching this up quickly seems good for now.

Fix #359

codecov[bot] commented 11 months ago

Codecov Report

Merging #373 (4ac765c) into main (1b048aa) will decrease coverage by 0.03%. The diff coverage is 90.00%.

@@            Coverage Diff             @@
##             main     #373      +/-   ##
==========================================
- Coverage   96.58%   96.56%   -0.03%     
==========================================
  Files          14       14              
  Lines        4160     4164       +4     
==========================================
+ Hits         4018     4021       +3     
- Misses        142      143       +1     
Files Coverage Δ
src/diagnostics.jl 93.18% <90.00%> (-1.82%) :arrow_down: