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

Improve error messages for missing opCmp / opEquals #20806

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

dkorpel
Copy link
Contributor

@dkorpel dkorpel commented Jan 30, 2025

No description provided.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @dkorpel! 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

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

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#20806"

Copy link
Contributor

@thewilsonator thewilsonator left a comment

Choose a reason for hiding this comment

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

diid you want to update the changelog with this at some point?

@dkorpel
Copy link
Contributor Author

dkorpel commented Jan 30, 2025

I generalized the wording in the changelog already, adding examples for every single operator overload would be a bit excessive

@dkorpel dkorpel merged commit 0ecefd7 into dlang:master Jan 30, 2025
39 of 42 checks passed
{
error(e.loc, "no operator `%s` for type `%s`", EXPtoString(e.op).ptr, ad.toChars);
string op = e.isEqualExp() ? "bool" : "int";
errorSupplemental(ad.loc, "perhaps overload it with `%.*s %s(%s other) const {}`", op.fTuple.expand, id.toChars, other.type.toChars);
Copy link
Member

Choose a reason for hiding this comment

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

This introduced a regression @dkorpel

dmd/opover.d:1144:94: error: no property ‘fTuple’ for ‘op’ of type ‘string’

For reasons I can't fathom, can't reproduce this with dmd 2.103.x, but seen with all releases of gdc-(9..14)

The error doesn't look wrong either - there's no import dmd.root.string; anywhere in the opover module!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a public import dmd.root.string: fTuple; to dmd/errors.d, right below the public import core.stdc.stdarg;. Are selective public imports broken on gdc?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, you added public import to the errors module - action at a spooky distance. :-)

I didn't bother syncing this as gdc implementation of dmd.errors is just a set of forward declarations.

@dkorpel dkorpel deleted the opover-opcmp-diag branch January 31, 2025 10:37
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