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

fix 24745 - improve associative array syntax error message #16832

Draft
wants to merge 1 commit into
base: stable
Choose a base branch
from

Conversation

royalpinto007
Copy link

No description provided.

@dlang-bot
Copy link
Contributor

dlang-bot commented Sep 9, 2024

Thanks for your pull request and interest in making D better, @royalpinto007! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
24745 enhancement Better error message when creating an associative array with the wrong syntax

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "stable + dmd#16832"

Signed-off-by: royalpinto007 <[email protected]>

fix 24745 - issue line

Signed-off-by: royalpinto007 <[email protected]>
@ryuukk
Copy link
Contributor

ryuukk commented Sep 9, 2024

why 6 lines of error messages? it should only be 1 line

Copy link
Contributor

@ntrel ntrel left a comment

Choose a reason for hiding this comment

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

  1. I think the new message should only be shown when detecting a colon after a non-identifier expression. E.g. it looks like the message would show for {expr expr}, which is unlikely to be intended as an array initializer.
  2. The message could say (associative) array, because array literals can have indexes too.

Edit: And (1) is why fail_compilation/fix350a.d and fail_compilation/fix350b.d are failing.

@royalpinto007 royalpinto007 marked this pull request as draft September 9, 2024 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants