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

Add array contains function #633

Merged
merged 3 commits into from
May 16, 2024
Merged

Add array contains function #633

merged 3 commits into from
May 16, 2024

Conversation

jdidion
Copy link
Collaborator

@jdidion jdidion commented Apr 8, 2024

Checklist

  • Pull request details were added to CHANGELOG.md
  • Valid examples WDL's were added or updated to the SPEC.md (see the guide on writing markdown tests)

@patmagee
Copy link
Member

patmagee commented Apr 9, 2024

@jdidion do we need to make any comments here on how equality works and whether type coerced objects are equal?

Ie would the following be truthy?

File Foo = "foo"
Array[String] bar = ["foo"]

@jdidion jdidion changed the base branch from wdl-1.1 to wdl-1.2 April 9, 2024 19:53
@jdidion
Copy link
Collaborator Author

jdidion commented Apr 9, 2024

@patmagee yes type coercion should apply here. String -> File is one of the officially supported coercions, but not File -> String.

Array[File] files = ["/foo/bar"]
contains(files, "/foo/bar")  # true

Array[String] strings = ["/foo/bar"]
File foobar = "/foo/bar"
contains(strings, foobar)  # error - `foobar` is not of type `String` and is not coercible to `String`
contains(strings, "~{foobar}")  # true

Copy link

@vsmalladi vsmalladi left a comment

Choose a reason for hiding this comment

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

LGTM

Did you want to add that example you ad in the discussion?

@jdidion jdidion merged commit 688de7e into wdl-1.2 May 16, 2024
@jdidion jdidion deleted the 117/contains branch May 22, 2024 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants