Closed curoli closed 7 years ago
Please attempt a unit test that shows that this enforces CommandLineTool's class
to always be "CommandLineTool."
I don't think it's possible, as it's not enforced when declared this way.
I'm looking at your loam stream repo to try to figure out what is going on.
I don't know how to make Unit tests about type safety, because I can't put stuff into unit tests that doesn't compile.
But let's see:
CommandLineTool() // compiles - good
CommandLineTool(class
= "Hello") // does not compile - good
CommandLineTool(class
= "Hello".narrow) // does not compile - good
CommandLineTool(class
= "CommandLineTool") // does not compile - I think that's fine
CommandLineTool(class
= "CommandLineTool",narrow) // does not compile - I think that's fine
CommandLineTool(class
= CommandLineTool.class
) // compiles - good
CommandLineTool(class
= Workflow.class
) // does not compile - good
That "CommandLineTool" and "CommandLineTool".narrow might look less than ideal, but I think it's OK, because using CommandLineTool.class
is better anyway. Besides, Shapeless calls these things singletons, so by design, you're not supposed to create a second instance of it, right?
With asInstanceOf[ClassType], you can assign anything, of course, but that's by design of asInstanceOf.
The remaining problem is that the Shapeless Witness is broken. The same code sometimes works in one place but not in another for no apparent reason. No amount of clever coding or testing can make us safe until Shapeless fixes it.
closing this as fix was applied in #214
Prevent the witness from sometimes committing perjury in cwl.CommandLineTool, the same way it was done before for cwl.Workflow.