mirror of https://github.com/sbt/sbt.git
This commit does the following things: * Removes the boolean from the instance context passes to the linter. * Prohibits the use of value inside anonymous functions. * Improves the previous check of `value` inside if. The improvements have occurred thanks to the fix of an oversight in the traverser. As a result, several implementation of tasks have been rewritten because of new compilation failures by both checks. Note that the new check that prohibits the use of value inside anonymous functions ignores all the functions whose parameters have been synthesized by scalac (that can happen in a number of different scenarios, like for comprehensions). Other scripted tests have also been fixed. Running `.value` inside an anonymous function yields the following error: ``` [error] /data/rw/code/scala/sbt/main-settings/src/test/scala/sbt/std/TaskPosSpec.scala:50:24: The evaluation of `foo` inside an anonymous function is prohibited. [error] [error] Problem: Task invocations inside anonymous functions are evaluated independently of whether the anonymous function is invoked or not. [error] [error] Solution: [error] 1. Make `foo` evaluation explicit outside of the function body if you don't care about its evaluation. [error] 2. Use a dynamic task to evaluate `foo` and pass that value as a parameter to an anonymous function. [error] [error] val anon = () => foo.value + " " [error] ^ ``` |
||
|---|---|---|
| .. | ||
| src | ||
| NOTICE | ||