aboutsummaryrefslogtreecommitdiff
path: root/.editorconfig
diff options
context:
space:
mode:
authorGeoff Reedy <geoff@programmer-monk.net>2021-09-22 20:30:31 -0600
committerGeoff Reedy <geoff@programmer-monk.net>2021-09-22 20:57:34 -0600
commit9d67332e4b8d75a101b8cf6e1d7e4dc8e99e964a (patch)
treeda6cb8fa7340ba1aa75e26202347983238ef24a6 /.editorconfig
parentbcd73ebf60bb9ba6cb09f8df4366d5474c16e4a4 (diff)
Better eval error locations for interpolation and +
Previously, type or coercion errors for string interpolation, path interpolation, and plus expressions were always reported at the beginning of the outer expression. This leads to confusing evaluation error messages making it hard to accurately diagnose and then fix the error. For example, errors were reported as follows. ``` cannot coerce an integer to a string 1| let foo = 7; in "bar" + foo | ^ cannot add a string to an integer 1| let foo = "bar"; in 4 + foo | ^ cannot coerce an integer to a string 1| let foo = 7; in "x${foo}" | ^ ``` This commit changes the ExprConcatStrings expression vector to store a sequence of expressions *and* their expansion locations so that error locations can be reported accurately. For interpolation, the error is reported at the beginning of the entire `${foo}`, not at the beginning of `foo` because I thought this was slightly clearer. The previous errors are now reported as: ``` cannot coerce an integer to a string 1| let foo = 7; in "bar" + foo | ^ cannot add a string to an integer 1| let foo = "bar"; in 4 + foo | ^ cannot coerce an integer to a string 1| let foo = 7; in "x${foo}" | ^ ``` The error is reported at this kind of precise location even for multi-line indented strings. This probably helps with at least some of the cases mentioned in #561
Diffstat (limited to '.editorconfig')
0 files changed, 0 insertions, 0 deletions