mill
mill copied to clipboard
Let `Task`-macros fail if their return value has a `Task`-type
Since I again ran into an issue where we forgot to call the .apply() of a Task.Command, I think returning a Task from a Task should be always an error.
Offending erroneous task:
def myRun(args: Seq[String]): Task[Unit] = Task.Anon {
run(Task.Anon(Args(args)))
}
The fix:
def myRun(args: Seq[String]): Task[Unit] = Task.Anon {
- run(Task.Anon(Args(args)))
+ run(Task.Anon(Args(args)))()
}
We could enhance our Task-macros to detect a return value of (sub-)type Task, in which case we should simply fail the compilation.