question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Map literals: improve type inference and error messages

See original GitHub issue

The struct has type File for member some_file, and task some_task has an output member some_file that has type File, so why is miniwdl check failing?

(test.wdl Ln 14 Col 26) Expected Array[File] instead of File
                "some_file": some_task.some_file,
                             ^^^^^^^^^^^^^^^^^^^
* Hint: for compatibility with older existing WDL code, try setting --no-quant-check to relax quantifier validation rules.
version 1.0
struct FooStruct {
    Array[File] list_of_files
    File some_file
}

workflow some_workflow {
    input {
        String file_name
    }
    output {
        FooStruct out = {
            "list_of_files": some_task.list_of_files,
            "some_file": some_task.some_file,
        }
    }
    call some_task  {
        input:
            file_name=file_name
    }
}

task some_task {
    input {
        String file_name
    }
    output {
      Array[File] list_of_files = glob("~{file_name}*.txt")
      File some_file = "~{file_name}.txt"
    }
    command <<<
        echo Hi > ~{file_name}.txt
    >>>
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
nh13commented, Oct 10, 2019

I’ll use the object literal constructor going forward but I’ll leave it open in case someone wants to implement it.

0reactions
mlincommented, Dec 20, 2021

@ynedelec I think the confusion between Map and object literals is inherent in WDL but I’m not sure exactly how Cromwell handles all these cases. The key fact relevant here is that a Map has homogeneous value types (and may have non-string keys).

WDL 1.1 has a new struct initialization syntax, but it’s essentially the same old object initializer except you replace object with the name of the struct.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Local Type Inference Cheat Sheet for Java 10 and beyond!
Local Type Inference Cheat Sheet for Java 10 and beyond! · 1. Reading code > Writing code. · 2. Code should be clear...
Read more >
Improving Type Error Messages in OCaml - Arthur Charguéraud
Cryptic type error messages are a major obstacle to learning OCaml or other ML-based languages. In many cases, error messages cannot be interpreted...
Read more >
proposal: spec: type inferred composite literals #12854 - GitHub
This proposal extends that permission to all occasions when the literal type can be derived. This proposal allows more concise code.
Read more >
Documentation - Template Literal Types - TypeScript
Generating mapping types which change properties via template literal strings.
Read more >
Unable to use composite literal with map[string][]struct [closed]
please find the code below. I am a newbie to Golang and perhaps have some less understanding about composite literals. type Assessment struct{ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found