ICU-20072 Move modified = true
before return
to fix hasMappings()
#3466
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This resolves a compiler warning:
collationdatabuilder.cpp:418:20: warning: code will never be executed [-Wunreachable-code]
.The
modified = true;
line after the loop insetPrimaryRangeAndReturnNext()
is unreachable due to thereturn
within thefor
loop and lack of anybreak
s. Unlike other methods in this file (e.g.,maybeSetPrimaryRange()
), wheremodified
is set before returning, this leavesmodified
unset despite trie updates. This could lead tohasMappings()
incorrectly returningfalse
when mappings have been added, potentially affecting downstream logic that depends on this flag. Movingmodified = true;
before thereturn primary;
ensures consistency with the class’s pattern and proper state tracking.Checklist