E118: Params No Inline

This error is emitted when the inline modifier is used on parameters of a non-inline method.

The inline modifier on parameters is only allowed for parameters of inline methods, where it enables the parameter to be inlined at the call site.


Example

def example(inline x: Int): Int = x + 1

Error

-- [E118] Syntax Error: example.scala:1:19 -------------------------------------
1 |def example(inline x: Int): Int = x + 1
  |                   ^
  |         inline modifier can only be used for parameters of inline methods

Solution

// Make the method inline as well
inline def example(inline x: Int): Int = x + 1
// Or remove inline from the parameter
def example(x: Int): Int = x + 1