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 #15303

Closed
wants to merge 1 commit into from

Conversation

WalterBright
Copy link
Member

No description provided.

@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#15303"

@WalterBright
Copy link
Member Author

Egad, an astounding number of diffs in the error messages.

@WalterBright
Copy link
Member Author

I'm going to try a different approach. This is too disruptive.

Copy link
Member

@ibuclaw ibuclaw left a comment

Choose a reason for hiding this comment

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

Some of the changes in diagnostic are dubious. A good chunk of them seem to stem from supplemental diagnostic messages being recorded and used to gag future genuine found errors. I suspect verrorPrint should be more capable to distinguish between diagnostica and supplementary information. That or having gag logic in verrorPrint is the wrong place to do so.

Comment on lines -53 to +44
fail_compilation/dtor_attributes.d(209): Error: `pure` function `dtor_attributes.test2` cannot call impure destructor `dtor_attributes.StrictClass.~this`
fail_compilation/dtor_attributes.d(204): generated `StrictClass.~this` is impure because of the following field's destructors:
fail_compilation/dtor_attributes.d(203): - HasDtor member
fail_compilation/dtor_attributes.d(103): impure `HasDtor.~this` is declared here
fail_compilation/dtor_attributes.d(209): Error: `pure` function `fail_compilation/dtor_attributes.test2` cannot call impure destructor `fail_compilation/dtor_attributes.StrictClass.~this`
fail_compilation/dtor_attributes.d(209): generated `StrictClass.~this` at fail_compilation/dtor_attributes.d(204) is impure because of the following field's destructors:
fail_compilation/dtor_attributes.d(209): field at fail_compilation/dtor_attributes.d(203) - HasDtor member
fail_compilation/dtor_attributes.d(209): impure `HasDtor.~this` is declared at fail_compilation/dtor_attributes.d(103)
Copy link
Member

Choose a reason for hiding this comment

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

Embedding file/line information in the message instead of cross-referencing the line is not an improvement, and makes diagnostic messages seriously worse for vcontext (enabled by default in at least one downstream).

Comment on lines 22 to +30
---
*/







Copy link
Member

Choose a reason for hiding this comment

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

I don't see the point in wasting time adding line padding. If it's really important to keep line numbers in TEST_OUTPUT stable, it's simpler to just use #line.

Comment on lines 4 to 8
fail_compilation/test13786.d(16): Deprecation: `debug = <integer>` is deprecated, use debug identifiers instead
fail_compilation/test13786.d(18): Deprecation: `version = <integer>` is deprecated, use version identifiers instead
fail_compilation/test13786.d(16): Error: debug `123` level declaration must be at module level
fail_compilation/test13786.d(17): Error: debug `abc` declaration must be at module level
fail_compilation/test13786.d(18): Error: version `123` level declaration must be at module level
fail_compilation/test13786.d(19): Error: version `abc` declaration must be at module level
fail_compilation/test13786.d(22): Error: template instance `test13786.T!()` error instantiating
Copy link
Member

Choose a reason for hiding this comment

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

Deprecations should never hide/gag errors. Does that also mean you won't see the error when compiling with '-dw`?

Comment on lines 5 to -6
fail_compilation/parse13361.d(14): Error: empty attribute list is not allowed
fail_compilation/parse13361.d(14): Error: use `@(attributes)` instead of `[attributes]`
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this just hiding the more important error?

Comment on lines -7 to 8
fail_compilation/issue20704.d(17): Error: `S(0)` is not an lvalue and cannot be modified
fail_compilation/issue20704.d(36): Error: template instance `issue20704.f2!(S)` error instantiating
fail_compilation/issue20704.d(17): Error: `null` is not an lvalue and cannot be modified
fail_compilation/issue20704.d(38): Error: template instance `issue20704.f2!(C)` error instantiating
Copy link
Member

Choose a reason for hiding this comment

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

So this change would mean you would get error instantiating messages, but the reason for failure is suppressed? How is that useful?

Comment on lines 5 to 7
fail_compilation/ice18753.d(23): Error: template instance `ice18753.isInputRange!(Group)` error instantiating
fail_compilation/ice18753.d(18): instantiated from here: `isForwardRange!(Group)`
fail_compilation/ice18753.d(23): instantiated from: `isForwardRange!(Group)` at fail_compilation/ice17853.d(18)
fail_compilation/ice18753.d(18): while evaluating: `static assert(isForwardRange!(Group))`
Copy link
Member

Choose a reason for hiding this comment

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

Embedding file/line in the message instead of cross referencing is not an improvement. Instantiation backtraces would suffer the most for this when vcontext is enabled.

Comment on lines 4 to 7
fail_compilation/fail10254.d(20): Error: `pure` function `fail10254.foo` cannot call impure constructor `fail10254.C.this`
fail_compilation/fail10254.d(20): Error: `@safe` function `fail10254.foo` cannot call `@system` constructor `fail10254.C.this`
fail_compilation/fail10254.d(15): `fail10254.C.this` is declared here
fail_compilation/fail10254.d(21): Error: `pure` function `fail10254.foo` cannot call impure constructor `fail10254.S.this`
fail_compilation/fail10254.d(21): Error: `@safe` function `fail10254.foo` cannot call `@system` constructor `fail10254.S.this`
fail_compilation/fail10254.d(16): `fail10254.S.this` is declared here
Copy link
Member

Choose a reason for hiding this comment

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

Isn't it better to diagnose both pure and @safe violations at the same time?

Comment on lines 123 to -124
compilable/sw_transition_complex.d(128): Deprecation: use of complex type `creal*` is deprecated, use `std.complex.Complex!(real)` instead
compilable/sw_transition_complex.d(128): Deprecation: use of imaginary type `ireal` is deprecated, use `real` instead
Copy link
Member

Choose a reason for hiding this comment

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

Deprecation message is gagged for no good reason.

@WalterBright
Copy link
Member Author

@ibuclaw I agree with much of your comments, but I've already decided to redo it: "I'm going to try a different approach. This is too disruptive."

@WalterBright
Copy link
Member Author

Replaced with #15306

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants