Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jeaye committed Feb 13, 2025
1 parent 8fa87ab commit 950aa76
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion compiler+runtime/src/cpp/jank/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ namespace jank::error
case kind::analysis_invalid_recur_from_try:
return "recur may not be used within a 'try'";
case kind::analysis_invalid_recur_args:
return "The argument arity passed to 'recur' don't match the function's arity";
return "The argument arity passed to 'recur' doesn't match the function's arity";
case kind::analysis_invalid_let:
return "Invalid let";
case kind::analysis_invalid_loop:
Expand Down
15 changes: 8 additions & 7 deletions compiler+runtime/src/cpp/jank/error/report.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,11 @@ namespace jank::error
* is collapsed by an ellipsis. Thus, we need to expand the ellipsis either partially
* or fully.
*
* We do this by finding the releveant ellipsis (there may be multiple) and inserting
* We do this by finding the releveant ellipses (there may be multiple) and inserting
* our lines before it. We also insert our own ellipsis at the start of our lines. By
* the end of this, we'll have our new lines with an ellipsis on either side. The
* pass we run at the end to remove unneeded ellipsis will clean those up. */
size_t last_ellipse{}, last_line_number{}, line_number_before_last_ellipse{};
size_t last_ellipsis{}, last_line_number{}, line_number_before_last_ellipsis{};
for(size_t i{}; i < lines.size(); ++i)
{
/* First loop until we find a line number larger than our start. We keep track
Expand All @@ -253,8 +253,8 @@ namespace jank::error
}
if(lines[i].kind == line::kind::ellipsis)
{
last_ellipse = i;
line_number_before_last_ellipse = last_line_number;
last_ellipsis = i;
line_number_before_last_ellipsis = last_line_number;
}
else if(s.line_start < lines[i].number)
{
Expand All @@ -265,17 +265,18 @@ namespace jank::error
for(size_t i{}; i < s.lines.size(); ++i)
{
/* Skip any duplicate lines which can mess with the ordering. */
if(s.lines[i].number != 0 && s.lines[i].number <= line_number_before_last_ellipse)
if(s.lines[i].number != 0 && s.lines[i].number <= line_number_before_last_ellipsis)
{
continue;
}
lines.emplace(lines.begin() + static_cast<ptrdiff_t>(last_ellipse + added_lines),
lines.emplace(lines.begin() + static_cast<ptrdiff_t>(last_ellipsis + added_lines),
std::move(s.lines[i]));
++added_lines;
}
/* We're inserting before the last ellipsis, so we end by putting an ellipsis at the
* start of everything we just added. That surrounds our added lines in two ellipsis. */
lines.emplace(lines.begin() + static_cast<ptrdiff_t>(last_ellipse), line::kind::ellipsis);
lines.emplace(lines.begin() + static_cast<ptrdiff_t>(last_ellipsis),
line::kind::ellipsis);

break;
}
Expand Down
6 changes: 3 additions & 3 deletions compiler+runtime/src/cpp/jank/read/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ namespace jank::read::parse
}
else
{
return error::parse_invalid_reader_symbolic_value("Unsupported symbolic value",
return error::parse_invalid_reader_symbolic_value("Invalid symbolic value",
{ start_token.start, latest_token.end });
}

Expand Down Expand Up @@ -800,7 +800,7 @@ namespace jank::read::parse
if(!truthy(splicing_allowed_var->deref()))
{
return error::parse_invalid_reader_splice({ start_token.start, latest_token.end },
"#?@ splice must not be top-level");
"Top-level #?@ usage is not allowed");
}

auto const s(next_in_place(it)->first());
Expand All @@ -824,7 +824,7 @@ namespace jank::read::parse
[&]() -> processor::object_result {
/* TODO: Get the source of just this form. */
return error::parse_invalid_reader_splice({ start_token.start, latest_token.end },
"#?@ splice must be a sequence");
"#?@ must be used on a sequence");
},
s);
}
Expand Down

0 comments on commit 950aa76

Please sign in to comment.