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 Issue 18528 - dmd should deduplicate identical errors #15306

Closed
wants to merge 1 commit into from

Conversation

WalterBright
Copy link
Member

Reboot #15303 with different approach, hopefully much less disruptive.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Auto-close Bugzilla Severity Description
18528 normal dmd should deduplicate identical errors

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

@WalterBright WalterBright force-pushed the fix18528-2 branch 3 times, most recently from b5d2218 to 0aa421d Compare June 11, 2023 03:05
@WalterBright
Copy link
Member Author

Still an amazing number of diffs.

@WalterBright WalterBright added the WIP Work In Progress - not ready for review or pulling label Jun 11, 2023
@ibuclaw
Copy link
Member

ibuclaw commented Jun 11, 2023

I suppose you've already tried node-based suppression?

I think the most common entrypoint for errors are the wrapper methods e.error("I didn't pass semantic checks");. Similarly, there's an e.errors boolean field that is set by many (but not all) nodes after an error occurs.

Do we already refuse to emit errors/deprecation if the errors field is already set?

@WalterBright
Copy link
Member Author

I suppose you've already tried node-based suppression?

A lot of that is done. The trouble is it is not a general solution, and I was looking for a general solution. But as this PR shows, I'm thinking I should look again at the node base solution, as this one is a bit too blunt.

Just adding the check to the e.error function won't work, as the supplemental messages also need to be suppressed.

@WalterBright
Copy link
Member Author

The specific message for this bugzilla is:

/Users/timothee/git_clone/D/ggplotd/source/ggplotd/geom.d(117,24): Deprecation: module `ggplotd.aes` member hasAesField is not visible from module geom
/Users/timothee/git_clone/D/ggplotd/source/ggplotd/geom.d(117,24): Deprecation: module `ggplotd.aes` member hasAesField is not visible from module geom

is not so easy to deal with without adding complexity.

@ibuclaw
Copy link
Member

ibuclaw commented Jun 12, 2023

I suppose you've already tried node-based suppression?

A lot of that is done. The trouble is it is not a general solution, and I was looking for a general solution. But as this PR shows, I'm thinking I should look again at the node base solution, as this one is a bit too blunt.

Just adding the check to the e.error function won't work, as the supplemental messages also need to be suppressed.

Only supplemental messages relating to the same error? Other supplemental messages should be fine to emit. Back traces being one such example where it is desired to have the same line twice.

@ibuclaw
Copy link
Member

ibuclaw commented Jun 12, 2023

I don't see it scaling well to always wrap grouped errors up into an if block - maybe a lambda?

Copy link
Contributor

@RazvanN7 RazvanN7 left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of this. A few notes:

  • stop adding #line directives to test files.
  • please delete the newly added extra lines in the test files.
  • updating the failure tests can be done automatically by running ./AUTO_UPDATE = 1 ./run.d test (except for test files where there are multiple error sections)
  • the current implementation is going to suppress some error messages when it shouldn't given that it takes only the location of the error message. This can already be observed in some of the modified test suite files. I assume there are other situations when we prune error messages when we shouldn't. Maybe a better way to do it is to the hash of the error message?


/************************************************************
* This is a simple scheme to eliminate duplication of error
* messages, which we'll define has having the same location.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* messages, which we'll define has having the same location.
* messages, which we'll define as having the same location.

* The complication is that messages come in groups,
* all with the same location. This is dealt with by having
* some messages trigger the start of a group, which ends only
* when another start is seen, at wich point the previous location
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* when another start is seen, at wich point the previous location
* when another start is seen, at which point the previous location





Copy link
Contributor

Choose a reason for hiding this comment

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

Please delete these extra lines.

---
*/


Copy link
Contributor

Choose a reason for hiding this comment

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

this change is unrelated to this PR

compilable/ddoc10236.d(71): Warning: Ddoc: parameter count mismatch, expected 2, got 0
compilable/ddoc10236.d(71): Note that the format is `param = description`
---
*/


Copy link
Contributor

Choose a reason for hiding this comment

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

this change is unrelated to this PR

compilable/sw_transition_complex.d(132): Deprecation: use of complex type `creal` is deprecated, use `std.complex.Complex!(real)` instead
---
*/

Copy link
Contributor

Choose a reason for hiding this comment

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

undo





Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

---
*/


Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@@ -8,7 +8,6 @@ fail_compilation/cpp_abi_tag.d(102): Error: `@gnuAbiTag` at least one argument e
fail_compilation/cpp_abi_tag.d(105): Error: `@gnuAbiTag` at least one argument expected
fail_compilation/cpp_abi_tag.d(108): Error: `@gnuAbiTag` char `0x99` not allowed in mangling
fail_compilation/cpp_abi_tag.d(114): Error: argument `2` to `@gnuAbiTag` cannot be `null`
fail_compilation/cpp_abi_tag.d(114): Error: argument `3` to `@gnuAbiTag` cannot be empty
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this message should be elided.

---
*/

#line 100
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, stop adding #line directives. This makes reviewing the code much more difficult.

@WalterBright
Copy link
Member Author

Abandoning this as unworkable in favor of #15314 and #15312

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fix Needs Rebase WIP Work In Progress - not ready for review or pulling
Projects
4 participants