dnanexus / wdlTools

WDL tools for parsing, type-checking, and more
Apache License 2.0
24 stars 7 forks source link

format sub command errors on instantiation of structs #216

Open wholtz opened 2 years ago

wholtz commented 2 years ago
$ cat example.wdl
version 1.0

struct Message {
   String text
   Int priority
}

workflow my_workflow {
  input {
    String text
    Int priority
  }

  Message alert = {
    "text": text,
    "priority": priority
  }
}
$ wdltools check example.wdl 
$ wdltools format example.wdl 
[error] Command scallop failed
java.lang.Exception: Unrecognized type TypeIdentifier(Message)
        at wdlTools.generators.code.WdlFormatter$DataType$.fromWdlType(WdlFormatter.scala:825)
        at wdlTools.generators.code.WdlFormatter$DeclarationBase.<init>(WdlFormatter.scala:1231)
        at wdlTools.generators.code.WdlFormatter$DeclarationStatement.<init>(WdlFormatter.scala:1250)
        at wdlTools.generators.code.WdlFormatter$DeclarationStatement$.apply(WdlFormatter.scala:1249)
        at wdlTools.generators.code.WdlFormatter$DeclarationStatement$.apply(WdlFormatter.scala:1249)
        at scala.collection.immutable.Vector1.map(Vector.scala:1872)
        at scala.collection.immutable.Vector1.map(Vector.scala:375)
        at wdlTools.generators.code.WdlFormatter$DeclarationsSection.<init>(WdlFormatter.scala:1254)
        at wdlTools.generators.code.WdlFormatter.wdlTools$generators$code$WdlFormatter$$splitWorkflowElements(WdlFormatter.scala:1498)
        at wdlTools.generators.code.WdlFormatter$WorkflowSections.<init>(WdlFormatter.scala:1616)
        at wdlTools.generators.code.WdlFormatter$WorkflowBlock.body(WdlFormatter.scala:1656)
        at wdlTools.generators.code.WdlFormatter$BlockStatement.<init>(WdlFormatter.scala:1272)
        at wdlTools.generators.code.WdlFormatter$WorkflowBlock.<init>(WdlFormatter.scala:1652)
        at wdlTools.generators.code.WdlFormatter$DocumentSections.format(WdlFormatter.scala:1873)
        at wdlTools.generators.code.WdlFormatter.formatElement(WdlFormatter.scala:1898)
        at wdlTools.generators.code.WdlFormatter.formatDocument(WdlFormatter.scala:1907)
        at wdlTools.generators.code.WdlFormatter.$anonfun$formatDocuments$1(WdlFormatter.scala:1914)
        at wdlTools.syntax.WdlParser$Walker.addDocument$1(WdlParser.scala:66)
        at wdlTools.syntax.WdlParser$Walker.walk(WdlParser.scala:80)
        at wdlTools.generators.code.WdlFormatter.formatDocuments(WdlFormatter.scala:1913)
        at wdlTools.cli.Format.apply(Format.scala:15)
        at wdlTools.cli.Main$.runCommand(Main.scala:36)
        at wdlTools.cli.Main$.delayedEndpoint$wdlTools$cli$Main$1(Main.scala:48)
        at wdlTools.cli.Main$delayedInit$body.apply(Main.scala:12)
        at scala.Function0.apply$mcV$sp(Function0.scala:39)
        at scala.Function0.apply$mcV$sp$(Function0.scala:39)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
        at scala.App.$anonfun$main$1(App.scala:76)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
        at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
        at scala.collection.AbstractIterable.foreach(Iterable.scala:926)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at wdlTools.cli.Main$.main(Main.scala:12)
        at wdlTools.cli.Main.main(Main.scala)

$ 
tweep commented 1 year ago

Great tool, thank you ! However I ran into the same issue when trying to reformat some code - a fix would be much appreciated. I tried a few older versions, look like this never was implemented.