-
-
Notifications
You must be signed in to change notification settings - Fork 609
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 21258 - Tuple parameters use the first element of a default tuple value #11749
Conversation
|
Thanks for your pull request, @Geod24! Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "stable + dmd#11749" |
|
@Geod24 very nice! |
|
Let's hold on for a couple hours, maybe someone will suggest additional tests (that someone might be me). |
|
@Geod24 If you could improve the commit message, to say what the typo caused that'd be good. |
|
Heh, the logic was flawed anyway and failed for tuples > 2 elements. Should be properly fixed now. |
|
Thanks for sorting it out so quickly! |
|
Fixed: Changed static array to two variables. |
src/dmd/typesem.d
Outdated
| @@ -1494,7 +1494,11 @@ extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc) | |||
| // Now that we completed semantic for the argument types, | |||
| // run semantic on their default values, | |||
| // bearing in mind tuples have been expanded. | |||
| size_t tupleStartIdx = size_t.max; | |||
| // We need to keep a pair of [oidx, eidx] (original index, | |||
| // extended index), so we now to run semantic when the original | |||
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.
grammar. get rid of to.
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.
Good catch. Actually the sentence wasn't quite accurate so I rephrased it.
… value The logic tried to use a single variable for both keeping track of the original index and the extended index, but actually only tracked the extended index. Since `if (tupleStartIdx < eidx) tupleStartIdx = eidx` would be true for every iteration, we would always assign the value at index 0.
|
Confirmed to fix our code. |
The logic tried to use a single variable for both keeping track of the
original index and the extended index, but actually only tracked the
extended index.
Since
if (tupleStartIdx < eidx) tupleStartIdx = eidxwould be truefor every iteration, we would always assign the value at index 0.