Skip to content

Improve message for misplaced using#15624

Draft
som-snytt wants to merge 1 commit intoscala:mainfrom
som-snytt:issue/15614-bad-using-message
Draft

Improve message for misplaced using#15624
som-snytt wants to merge 1 commit intoscala:mainfrom
som-snytt:issue/15614-bad-using-message

Conversation

@som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Jul 8, 2022

Offer extra feedback when soft keyword using is found in identifier position, because it is a common beginner mistake.

def f(i: Int, using j: Int) = i + j

Skipping to the intended j may also reduce subsequent "not found" errors.

In Vulpix, show actual errors when no errors are marked. It is unlikely that this is "TMI" for the developer. Automatic -rewrite is left for another day.

Fixes #15614

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

@som-snytt som-snytt marked this pull request as ready for review July 9, 2022 08:32
odersky
odersky previously requested changes Jul 9, 2022
@som-snytt
Copy link
Contributor Author

som-snytt commented Jul 9, 2022

Thanks again for the quick review. A little bit of experienced feedback goes a long way.

Following is note-to-self:

Updated without tokens for using, erased. Worth noting that using is enshrined as a standard name, but tracking down usages is still tricky. Similarly, I wondered why then isn't rewritten. What is handled where? Every special case increases complexity.

Modified the verbose advice to say an error makes a symbol unavailable. That happens frequently during a refactor, where fixing one site results in further errors in the next run.

Internet suggests "misspelt" is becoming archaic. Also, although I love forms such as "spelt", "spelt" also means "wheat", and we know overloading is evil.

Edit: the message says "soft token" instead of "soft keyword", and on the ticket Bjorn asks for more specific advice about "mixing regular and using params." Maybe just say "the keyword must appear at the beginning of the param clause".

#15614 (comment)

Copy link
Contributor

@bjornregnell bjornregnell left a comment

Choose a reason for hiding this comment

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

I think the error messages and explaining texts read good.

@som-snytt
Copy link
Contributor Author

@odersky Please approve based on Bjorn's approval.

@som-snytt som-snytt closed this Oct 9, 2022
@bjornregnell
Copy link
Contributor

I may be missing some context here, but why closed instead of merged? @som-snytt

@som-snytt som-snytt reopened this Aug 6, 2024
@som-snytt som-snytt force-pushed the issue/15614-bad-using-message branch from 4af5ac4 to 79d05aa Compare August 6, 2024 10:54
@som-snytt som-snytt marked this pull request as draft August 6, 2024 10:55
@som-snytt som-snytt force-pushed the issue/15614-bad-using-message branch from 79d05aa to 5581cdb Compare August 6, 2024 21:00
@som-snytt
Copy link
Contributor Author

rebased, squashed, removed some words during ugly merge.

@som-snytt som-snytt marked this pull request as ready for review August 7, 2024 14:17
@som-snytt
Copy link
Contributor Author

@bjornregnell Could you re-review and perhaps get official sanction?

The previous effort included heavier edit of the explain text, which I omit here because of the heavy merge.

The previous effort included handling erased, which is no longer needed.

The only trick in parser is error recovery in skipping bad token to the presumably intended ident.

I'll also update the introductory comment above.

@bjornregnell
Copy link
Contributor

LGTM
Thanks for nice work in increasing quality of life on planet Earth @som-snytt
I think this is ready to be merged @odersky - who should do that?

@som-snytt som-snytt closed this Sep 15, 2024
@som-snytt
Copy link
Contributor Author

Reopening to reconsider this forgotten bit.

@som-snytt som-snytt reopened this Nov 29, 2025
@som-snytt som-snytt marked this pull request as draft November 29, 2025 16:33
@Gedochao Gedochao added the stat: stale PR Marks any stale PRs, if no response is given, the PR qualifies as a one to close. label Feb 16, 2026
@Gedochao
Copy link
Contributor

@som-snytt is this still relevant? Do you plan to work on this in the near future, or should we close it?

@som-snytt som-snytt force-pushed the issue/15614-bad-using-message branch from 5581cdb to d2521d1 Compare February 17, 2026 19:45
@som-snytt
Copy link
Contributor Author

I'm not sure it was ever relevant, but I have refreshed the PR.

@som-snytt som-snytt removed the stat: stale PR Marks any stale PRs, if no response is given, the PR qualifies as a one to close. label Feb 17, 2026
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.

Misleading error message when trying to mix normal parameters and context parameters in the same parameter list

4 participants