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

Lack of type narrowing from defined() #720

Open
multimeric opened this issue Nov 21, 2024 · 0 comments
Open

Lack of type narrowing from defined() #720

multimeric opened this issue Nov 21, 2024 · 0 comments

Comments

@multimeric
Copy link
Contributor

Say I have the following task:

version 1.0

task Test {
  input {
    Int? optional
  }

  command {}

  output {
    Int x = if defined(optional) then optional else 0
  }
}

Validation with miniwdl will fail:

$ miniwdl check miniwdl_narrowing.wdl
(miniwdl_narrowing.wdl Ln 11 Col 13) Expected Int instead of Int? -- to coerce T? X into T, try select_first([X,defaultValue]) or select_first([X]) (which might fail at runtime); to coerce Array[T?] X into Array[T], try select_all(X)
        Int x = if defined(optional) then optional else 0
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* Hint: for compatibility with older existing WDL code, try setting --no-quant-check to relax quantifier validation rules.

Using miniWDL 1.12.1

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

No branches or pull requests

1 participant