Skip to content

Add hints for Num.to_str and Inspect.to_str does-not-exist errors - #10410

Open
JoeJoeflyn wants to merge 1 commit into
roc-lang:mainfrom
JoeJoeflyn:fix-issue-9191-9192-to-str-hints
Open

Add hints for Num.to_str and Inspect.to_str does-not-exist errors#10410
JoeJoeflyn wants to merge 1 commit into
roc-lang:mainfrom
JoeJoeflyn:fix-issue-9191-9192-to-str-hints

Conversation

@JoeJoeflyn

Copy link
Copy Markdown

Summary

  • When a user writes Num.to_str(value), the "Does Not Exist" error now hints to use method syntax value.to_str() instead
  • When a user writes Inspect.to_str(value), the error now hints that it was renamed to Str.inspect
  • Follows the existing hint pattern in ModuleEnv.zig (e.g. addAnnotated("Hint:", .emphasized))

Verification

  • zig build run-snapshot-tool -- test/snapshots/can_does_not_exist_inspect_to_str_hint.md
  • zig build run-check-snapshots
  • zig build run-test-zig -- --test-filter "qualified_ident" — all 4 tests passed
  • Updated existing snapshot test/snapshots/plume_package/Color.md (now shows the hint)

Fixes #9191
Fixes #9192

When a Roc programmer uses the removed `Num.to_str` or renamed
`Inspect.to_str`, the "Does Not Exist" error now shows a hint pointing
to the replacement:

- `Num.to_str(value)` -> use method syntax `value.to_str()`
- `Inspect.to_str`    -> renamed to `Str.inspect`

Fixes roc-lang#9191
Fixes roc-lang#9192
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Num.to_str better error message Inspect.to_str better error

1 participant