docs/_docs/reference/error-codes/E207.md
This error occurs when the @unroll annotation is used in an invalid location. The @unroll annotation is an experimental feature that can only be applied to method parameters with default values.
The @unroll annotation is used to generate multiple overloaded versions of a method to maintain binary compatibility when adding new parameters with default values.
import scala.annotation.unroll
@unroll
class UnrollClass
-- [E207] Declaration Error: example.scala:4:6 ---------------------------------
4 |class UnrollClass
| ^
| @unroll is only allowed on a method parameter
Use the @unroll annotation only on method or constructor parameters that have default values:
import scala.annotation.unroll
import scala.annotation.experimental
@experimental
final class Unrolled(s: String, n: Int = 1, @unroll b: Boolean = true):
def foo = s + n + b
Note that @unroll has additional restrictions:
This is an experimental feature and requires the -experimental compiler flag.