-
-
Notifications
You must be signed in to change notification settings - Fork 593
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
Bug7097 #577
Bug7097 #577
Conversation
} | ||
assert(ad); | ||
|
||
Dsymbol *dsym = search_function(ad, Id::opDollar); |
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.
It is probably worth using ad->search instead here, this allows opDollar to match any declaration instead of just functions.
See #203 for an example.
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.
Yeah, we should do that.
I'm surprised that bug 7097 is not yet fixed. I've found it in the reviewing of this pull. |
I could probably get to this within this week. Are you working on that one too? |
Yesterday, I've started to fix, but I found this pull after that. Then I stopped my work. |
Sorry, I should have created a backlink in bugzilla. |
Can we get this in before the next release? |
I'd like to merge this in 2.060. @dawgfoto , can you rebase this? |
It was unclear to me from a cursory look - does opDollar work with infinite ranges? The following should work: struct A {
enum empty = false;
struct Dullah {}
Dullah opDollar() { return Dullah.init; }
A opSlice(size_t from, Dullah) { ... }
} In other words, it should be possible to slice an infinite range with |
It would work. All of operator overloading mechanisms would work just like syntactic rewriting. |
Then I approve the design of this diff. Committers, please review implementation and merge. Thanks! |
@dawgfoto, you had already rebased the commits two months ago, but I didn't noticed it. Sorry. So, please re-rebase commits, and write comment in here. Github would notify me the comment by e-mail, and I'll be able to merge this immediately. |
This has not worked up until now, because my original opDollar implementation was very conservative (I made the patch before the feature was actually accepted). It only worked with indexing, and I tried to make sure it as unintrusive as possible. This LGTM. |
Remove std.contracts (deprecated a long, long time ago).
@dawgfoto Bump for a rebase. |
OK |
- length has been deprecated for almost 2 years - extending opDollar to all array indexing would affect code using length otherwise.
- extend ArrayScopeSymbol::search to handle opDollar for SliceExp - merge existing code into resolveOpDollar helper functions
Thanks for your work, @dawgfoto! |
fix Issue 7097 - opDollar doesn't work with slicing
- fix usage of templated opDollar with one-dimensional opSlice
not doing so could break code that uses a length variable/property within
one of the added expressions