Back to Scala3

E085: Function Type Needs Non-Empty Parameter List

docs/_docs/reference/error-codes/E085.md

3.8.41.5 KB
Original Source

E085: Function Type Needs Non-Empty Parameter List

This error was removed before Scala 3.0.0 was released and was never emitted by the Scala 3 compiler. This error was triggered when attempting to define implicit or erased function types with empty parameter lists.

Example (would have failed in early Dotty versions)

scala
type Contextual[T] = implicit () => T
val x: implicit () => Int
val y: erased () => Int
val z: erased implicit () => Int

Error

scala
-- Error: example.scala:1:26 ---------------------------------------------------
1 |type Contextual[T] = implicit () => T
  |                              ^^
  |implicit function type needs non-empty parameter list

Explanation

In early versions of Dotty (before Scala 3.0.0), it was not allowed to leave implicit or erased function parameter lists empty. This restriction was removed in commit d34b677d88 (May 2018) as it was considered an unnecessary limitation.

The error message suggested defining the function types with explicit parameters:

scala
type Transactional[T] = implicit Transaction => T
val cl: implicit A => B

Since Scala 3.0.0, empty parameter lists are allowed for implicit and erased function types, making this error obsolete.

<!-- SOURCE-ONLY: Remove the notice below once this page has been manually updated. --> <aside class="warning"> This reference page was created with LLM assistance - the description of the error code may not be accurate or cover all possible scenarios. </aside>