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 Bugzilla 24745 - improve associative array syntax error message #16832

Merged
merged 1 commit into from
Nov 17, 2024

Conversation

royalpinto007
Copy link
Contributor

@royalpinto007 royalpinto007 commented Sep 9, 2024

Enhance error messages for associative array syntax.

@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 "master + dmd#16832"

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
@royalpinto007 royalpinto007 changed the base branch from stable to master November 15, 2024 06:13
@royalpinto007 royalpinto007 force-pushed the assoc_arr-error-msg branch 2 times, most recently from ac9167c to 3071bf1 Compare November 15, 2024 08:30
@royalpinto007 royalpinto007 marked this pull request as ready for review November 15, 2024 08:32
@royalpinto007 royalpinto007 changed the title fix 24745 - improve associative array syntax error message fix Bugzilla 24745 - improve associative array syntax error message Nov 15, 2024
compiler/test/fail_compilation/fix350a.d Outdated Show resolved Hide resolved
Signed-off-by: royalpinto007 <royalpinto007@gmail.com>
@royalpinto007
Copy link
Contributor Author

I think this can be merged as well? @thewilsonator

@thewilsonator thewilsonator dismissed dkorpel’s stale review November 17, 2024 00:07

no longer affect not assoc arrays

@thewilsonator thewilsonator merged commit 36c58b7 into dlang:master Nov 17, 2024
40 of 41 checks passed
@royalpinto007 royalpinto007 deleted the assoc_arr-error-msg branch November 17, 2024 00:09
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.

5 participants