Back to Scala3

E143: Erased Types Can Only Be Function Types

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

3.8.4858 B
Original Source

E143: Erased Types Can Only Be Function Types

This error occurs when the erased keyword is used in a type context that is not a function type.

The erased keyword is an experimental feature that marks function parameters as erased at runtime. When used in type annotations, erased can only appear in function types of the form (erased ...) => ....

Note: This error code is difficult to reproduce in practice because the parser typically reports E040 ("=> expected") before reaching this specific error. The E143 error may only be triggered in specific internal parsing paths.

<!-- 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>