fix Issue 18480 - dmd 2.079 hangs#7930
Conversation
|
Thanks for your pull request and interest in making D better, @timotheecour! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
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
|
992afc5 to
6949a54
Compare
|
Thanks, but mind the CI failures + please add a test for it to fail_compilation. |
src/dmd/access.d
Outdated
| auto aliasee = ad.toAlias(); | ||
| if (aliasee.isFuncAliasDeclaration || aliasee.isOverDeclaration) | ||
| { | ||
| error(ad.loc, "`alias X = X` not allowed (with `X = %s`)", ad.toChars()); |
There was a problem hiding this comment.
Why is it not allowed? What's the fundamental issue? Also, isn't there a way to print the actual syntax the user wrote in their source code (s.toChars() maybe), rather than giving them a syntax pattern?
There was a problem hiding this comment.
should be fixed with latest commit
the issue is to fix the infinite loop.
Also, isn't there a way to print the actual syntax the user wrote
alias X=X is more searchable in bug reports
See also: #6676 (comment) |
seems to (at least so far) pass now; |
|
This solves this issue : https://issues.dlang.org/show_bug.cgi?id=18432 |
e0e116c to
e975a30
Compare
|
This fixes the issue more on the symptom side (by detecting the infinite loop in the weird overload "data structure"), I'd like to spent a bit more time to better understand what's happening (and have a good test case) and to address the issue around The current overload structure is unfortunately a horrible implementation that needs a design change and some refactoring. Would be great if we just collected all overloads in a plain array and checked for duplicates during semantic, rather than using those recursive, polymorphic calls to overloadInsert. |
|
@MartinNowak how about merging this in the meantime to avoid having this bug in git master? one can always revert this once a better solution comes along. This PR doesn't make anything worse but it fixes the above (serious) bug |
|
Reduced test case --- moduleA.d
module moduleA;
template TestTemplate() { }
--- moduleB.d
module moduleB;
import moduleA : TestTemplate;
alias TestTemplate = TestTemplate;
--- main.d
import moduleB;
alias TestTemplate = moduleB.TestTemplate;
void main() { }compile with: |
e975a30 to
fc59ea7
Compare
|
@timotheecour 65 commits? I think you made a mistake with Git. |
fc59ea7 to
056d1a7
Compare
fixed... is targetting |
|
@JinShil thanks, added reduced test |
056d1a7 to
351f4d3
Compare
|
PTAL, rebased against stable; |
9dd51f9 to
9de5cd9
Compare
This or any other usage of the alias import moduleB : TestTemplate;is sufficient for main.d and just running |
14c3583 to
e1881fb
Compare
|
@MartinNowak changed to |
e1881fb to
8bc5441
Compare
8bc5441 to
1092c10
Compare
|
PTAL, failure in https://ci.dlang.io/blue/organizations/jenkins/dlang-org%2Fdmd/detail/PR-7930/14/pipeline seems irrelevant |
|
I think the correct place to address this problem is in Line 712 in 75b460e I tried to create a fix, but failed. I don't see anyway to compare two symbol instances to see if they are actually pointing to the same thing. |
|
how about merging this in meantime and if you find a better fix we can always revert? this bug is serious and we shd fix before upcoming release |
|
The FBSD error is unrelated, seems like Brad is trying to migrate or update the boxes as Github rightfully dropped SSLv23 support. |
Yes, for those interested in following / subscribing / learning more about this -> braddr/d-tester#70 |
|
The order of what happens is as follows.
This bug was there since, it has just been additionally exposed now when that loop is selectively imported. Calls to mostVisibibleOverload are inserted into basically every symbol usage though, so it was just dormant. |
|
It's unclear why the |
No description provided.