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 the includes function #148

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

akihiro17
Copy link
Contributor

@akihiro17 akihiro17 commented Jun 3, 2024

Resolve #118

In this commit, includes iterates over an array and returns true if it finds a match. Additionally, I have added more test cases for the includes function.

I guess this commit introduces a breaking change to the includes function.

before

script

import { includes } from "std"

let array = [1, 2]

echo includes(array, 1)
echo includes(array, "1")

1
1

after

Cannot compare two values of different types 'Num' == 'Text'
at [standard library]:125:14
in test.ab:1:1

Copy link
Member

@Ph0enixKM Ph0enixKM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR! I was about to fix it asap. Well done! 🎉

LGTM

Copy link
Contributor

@arapower arapower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@arapower arapower merged commit 2d9c87f into amber-lang:master Jun 4, 2024
1 check passed
@akihiro17 akihiro17 deleted the fix-include-functions branch June 4, 2024 13:00
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.

🐞 includes function in standard library incorrect (false positives)
4 participants