Skip to content

Scala docs on extension methods #9339

Closed
@nicolasstucki

Description

@nicolasstucki

Where can we add the documentation of an extension method?

// This should work
/** Doc of `foo` */
extension (x: T) def foo(): U = ...

// Should this work? Should it warn?
/** Doc of `foo` */
extension (x: T) 
  def foo(): U = ...

extension (x: T) 
  // This should work
  /** Doc of `foo` */
  def foo(): U = ...

// Should this work? It is fragile if another method is added. Should it warn?
/** Doc of `foo` */
extension (x: T):
  def foo(): U = ...

extension (x: T):
  //  This should work
  /** Doc of `foo` */
  def foo(): U = ...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions