Map literals: improve type inference and error messages
See original GitHub issueThe 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:
- Created 4 years ago
- Comments:8 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ll use the object literal constructor going forward but I’ll leave it open in case someone wants to implement it.
@ynedelec I think the confusion between
Map
andobject
literals is inherent in WDL but I’m not sure exactly how Cromwell handles all these cases. The key fact relevant here is that aMap
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.