-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat: implement the generic map functions from the WDL standardy library. #257
Conversation
This commit implements the `as_pairs` function from the WDL standard library.
This commit implements the `as_map` function from the WDL standard library.
This commit implements the `keys` function from the WDL standard library.
This commit implements the `contains_key` function from the WDL standard library. It also corrects a few issues discovered during testing: * Map values in `wdl-engine` should accept `None` for a key. * Common type calculation now supports discovering common types between the compound types containing `Union` and `None` as inner types, e.g. `Array[String] | Array[None] -> Array[String?]` * The "required primitive type" constraint has been removed as every place the constraint was used should allow for optional primitive types as well; consequently, the `AnyPrimitiveTypeConstraint` was renamed to simply `PrimitiveTypeConstraint`. * The common type calculation now favors the "left-hand side" of the calculation rather than the right, making it more intuitive to use. For example, a calculation of `File | String` is now `File` rather than `String`. Added test cases to existing functions that accept maps with optional primitive keys.
This commit implements the `values` function from the WDL standard library.
This commit implements the `collect_by_key` function from the WDL standard library.
.unwrap(); | ||
assert!(value.unwrap_boolean()); | ||
|
||
let value = eval_v1_expr( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also test baz
after this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that I better understand, what would be the expression to test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do test ['bar', 'baz']
further below (should be true), if that's what you mean.
Otherwise, a test for ['baz']
would be the same as a test for ['qux']
here (neither are keys of the Foo
struct); I can change the test to use baz
instead, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to merge this as-is and put up a follow-up PR if warranted after discussion.
This PR implements the following WDL standard library functions:
as_pairs
as_map
keys
contains_key
values
collect_by_key
It also corrects a few issues discovered during testing:
wdl-engine
should acceptNone
for a key.compound types containing
Union
andNone
as inner types, e.g.Array[String] | Array[None] -> Array[String?]
constraint was used should allow for optional primitive types as well;
consequently, the
AnyPrimitiveTypeConstraint
was renamed to simplyPrimitiveTypeConstraint
.calculation rather than the right, making it more intuitive to use. For
example, a calculation of
File | String
is nowFile
rather thanString
.Added test cases to existing functions that accept maps with optional primitive keys.
Before submitting this PR, please make sure:
changes (when appropriate).
CHANGELOG.md
(see"keep a changelog" for more information).