The concat method was not properly updating this.fragments because Array.prototype.concat returns a new array and does not modify the original array in place. Changed the implementation to use this.fragments.push(...other.fragments); to correctly merge the fragments into this.fragments.
Description
I thought concat method in TokenizedStringFragments was intended to merge fragments from another instance into this.fragments. However, it was not functioning correctly because Array.prototype.concat returns a new array and does not modify the original array in place.
To fix this issue, I updated the concat method to use this.fragments.push(...other.fragments);. This modifies this.fragments in place and ensures that all fragments are correctly merged.
The
concat
method was not properly updatingthis.fragments
becauseArray.prototype.concat
returns a new array and does not modify the original array in place. Changed the implementation to usethis.fragments.push(...other.fragments);
to correctly merge the fragments intothis.fragments
.Description
I thought
concat
method inTokenizedStringFragments
was intended to merge fragments from another instance intothis.fragments
. However, it was not functioning correctly becauseArray.prototype.concat
returns a new array and does not modify the original array in place.To fix this issue, I updated the
concat
method to usethis.fragments.push(...other.fragments);
. This modifiesthis.fragments
in place and ensures that all fragments are correctly merged.Checklist