Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scanner: remove redundancy from the message suggesting to use quotes instead of backticks for characters #22390

Merged

Conversation

StunxFS
Copy link
Contributor

@StunxFS StunxFS commented Oct 2, 2024

When using "`" for literals that are not characters, the compiler recommends using quotes for string, so far everything is fine, the problem is that when the compiler recommends that, it returns to showing the position where the error occurs, which is unnecessary, since the position is already shown previously.

This PR removes that part of the suggestion.

Before:

main.v:2:9: error: invalid character literal `ABC` => `ABC` ([`A`, `B`, `C`]) (more than one character)
    1 | fn main() {
    2 |     _ = `ABC`
      |         ^
    3 | }
Details: 
main.v:2:9: details: use quotes for strings, backticks for characters
    1 | fn main() {
    2 |     _ = `ABC`
      |         ^
    3 | }

After:

main.v:2:9: error: invalid character literal `ABC` => `ABC` ([`A`, `B`, `C`]) (more than one character)
    1 | fn main() {
    2 |     _ = `ABC`
      |         ^
    3 | }
Details: use quotes for strings, backticks for characters

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find. I do not know how we reached the current state, but it is showing redundant info indeed.

@spytheman spytheman merged commit 2b546c4 into vlang:master Oct 2, 2024
78 checks passed
@StunxFS StunxFS deleted the improve_invalid_character_lit_error branch October 2, 2024 19:02
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.

2 participants