fix: add hints for Num.to_str and Inspect.to_str errors#9283
fix: add hints for Num.to_str and Inspect.to_str errors#9283Sim-hu wants to merge 1 commit intoroc-lang:mainfrom
Conversation
When a user writes Num.to_str or Inspect.to_str, the error message now includes a hint suggesting the correct syntax: - Num.to_str(value) -> value.to_str() (method syntax) - Inspect.to_str -> Str.inspect (renamed) Closes roc-lang#9192 Closes roc-lang#9191
Head branch was pushed to by a user without write access
7d22c4b to
52f7547
Compare
|
Did you mean to drop my commits? I'm not sure why CI failed in that last run, it looks like just the cross-compile runners -- but it's not clear what the issue was. It doesn't look to me like it's related to this change, but there must be something I guess. I'll kick off CI so we can try again without the tests I added. |
|
Sorry about that — I rebased to pick up recent fixes and force-pushed without checking if you'd added commits. Won't happen again. |
|
Thank you for your contribution! Sometimes PRs end up staying open for a long time without activity, which can make the list of open PRs get long and time-consuming to review. To keep things manageable for reviewers, this bot automatically closes PRs that haven’t had activity in 60 days. This PR hasn’t had activity in 30 days, so it will be automatically closed if there is no more activity in the next 30 days. Keep in mind that PRs marked |
Closes #9192
Closes #9191
When a user writes
Num.to_str(value)orInspect.to_str(value), the current error just says the identifier doesn't exist. This adds a hint after the error pointing them to the right syntax:Num.to_str: suggests method syntaxvalue.to_str()Inspect.to_str: suggests the renamed functionStr.inspectFollows the existing hint pattern used elsewhere in
ModuleEnv.zig(e.g.addAnnotated("Hint:", .emphasized)).