Skip to content
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(iter): tap #1371

Merged
merged 3 commits into from
Dec 26, 2024
Merged

fix(iter): tap #1371

merged 3 commits into from
Dec 26, 2024

Conversation

peter-jerry-ye
Copy link
Collaborator

The tap should be used to perform side effects during the iteration of one item instead of rerunning the iteration.

Copy link

peter-jerry-ye-code-review bot commented Dec 26, 2024

‼️ This code review is generated by a bot. Please verify the content before trusting it.

Here are three observations from the provided git diff output:

  1. Deprecation Marker Removed:
    The tap function in builtin/builtin.mbti had a //deprecated comment, which was removed. This suggests that the function is no longer deprecated. However, the implementation of tap in builtin/iter.mbt was also modified, and the deprecation alert (@alert deprecated) was removed. This change should be carefully reviewed to ensure that the function is indeed no longer deprecated and that the new implementation aligns with the intended behavior.

  2. Behavioral Change in tap Function:
    The implementation of the tap function in builtin/iter.mbt was changed. Previously, it used self.each(f) and returned self, but now it uses self.map to apply the function f and return the original value. This change alters the behavior of the function. For example, in the test case in builtin/iter_test.mbt, the output changed from "1234512345" to "1122334455". This indicates that the function now processes each element twice (once in tap and once in each), which might not be the intended behavior.

  3. Test Case Update:
    The test case for the tap function in builtin/iter_test.mbt was updated to reflect the new behavior of the tap function. However, the expected output ("1122334455") suggests that the function is being applied twice, which might not be the desired outcome. This should be reviewed to ensure that the test case correctly reflects the intended behavior of the tap function.

In summary, the changes to the tap function and its test case should be carefully reviewed to ensure that the new behavior aligns with the intended functionality and that the deprecation status is correctly handled.

@coveralls
Copy link
Collaborator

coveralls commented Dec 26, 2024

Pull Request Test Coverage Report for Build 4353

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.006%) to 83.306%

Totals Coverage Status
Change from base Build 4349: 0.006%
Covered Lines: 4636
Relevant Lines: 5565

💛 - Coveralls

@bobzhang bobzhang enabled auto-merge (rebase) December 26, 2024 05:51
@bobzhang bobzhang merged commit 921e2f7 into main Dec 26, 2024
13 checks passed
@bobzhang bobzhang deleted the zihang/fix-tap branch December 26, 2024 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants