Back to Scala3

E151: Extension Method Cannot Have Type Parameters

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

3.8.4753 B
Original Source

E151: Extension Method Cannot Have Type Parameters

This error occurs when an extension method defines its own type parameters while the enclosing extension clause already has type parameters. When an extension clause has collective type parameters, all methods within it share those parameters. If a method needs additional type parameters, they should be moved to the extension clause's type parameter list instead.

Note This error was never emitted by stable Scala 3 compiler.

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