fix: add hints for Num.to_str and Inspect.to_str errors#9283
Open
Sim-hu wants to merge 1 commit intoroc-lang:mainfrom
Open
fix: add hints for Num.to_str and Inspect.to_str errors#9283Sim-hu wants to merge 1 commit intoroc-lang:mainfrom
Sim-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
auto-merge was automatically disabled
March 22, 2026 10:09
Head branch was pushed to by a user without write access
7d22c4b to
52f7547
Compare
Collaborator
|
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. |
Author
|
Sorry about that — I rebased to pick up recent fixes and force-pushed without checking if you'd added commits. Won't happen again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)).