-
-
Notifications
You must be signed in to change notification settings - Fork 610
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 19829 - __traits(isSame) returns true for some non-local de… #9710
Conversation
|
Thanks for your pull request and interest in making D better, @Biotronic! 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
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#9710" |
So That's another bug, isn't it? |
|
You're right. In fact, there's a whole bunch of different things that could happen inside the lambda that should mark it as incomparable. Working on that now. |
|
Maybe a better fix would be to use the mangled name of the variable so that the comparison is rightly done. |
|
That would mean |
No. I forgot that lambda comparison cannot be done for lambdas that contain non-parameter variables and I was suggesting that the functionality is extended so that lambda comparison works properly with local/global variables by using in the serialization the mangled name of the variable. I just figured that that would need a bit more work because it would require additional semantic passes to be performed. For now, the fix should be to add a serialization mechanism for arrays. |
|
Please retarget this to stable. Should this be merged soon and then the other issues fixed in another PR? |
|
Yes. |
|
Alright this is good to go as soon as it targets stable. |
|
Why stable? If I'm reading CONTRIBUTING.md correctly, that's for regressions only. Also, the version you approved does not, as aG0aep6G pointed out, correctly handle Supporting global variables and the like would be an enhancement, and so should be handled elsewhere. |
|
Bah. Or maybe not, since the tests in testlambdacomp assume that many things work that aren't implemented. |
Its also for serious bug fixes and for bug fixes that will trivially result in no regressions. |
|
| override void visit(TypeExp) { buf.reset(); } | ||
| override void visit(TypeidExp) { buf.reset(); } | ||
| override void visit(VoidInitExp) { buf.reset(); } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't simply overwriting the Expression node account for all those cases?
override void visit(Expression) { buf.reset(); }There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems reasonable, and was the first thing I tried, but I can't seem to get it to work.
|
It's actually worse than I thought. Try this: The identifier lookup in lambdacomp is very simplistic, and will match identifiers in the local scope when it shouldn't. |
3554fc9 to
a0ecc6b
Compare
…legate lambdas even when they are different
|
The lambda comparison works only for things that can be known right after parsing and with minimal semantic information. The examples that you have shown all require that semantic3 is ran before fetching that kind of information. |
|
No point waiting any longer for this. |
…legate lambdas even when they are different
As shown in the issue,
prints
true. This is because the presence ofxis not indicated in any way in the lambda serialization. This PR fixes that by making lambdas incomparable when they use identifiers that are not in the parameter list.