Skip to content

Add @ambiguiousImplicits annotation similar to @implicitNotFound #6806

Closed
@scabug

Description

@scabug

Ambiguous implicit values can be employed intentionally in order to enforce a compile-time constraint (see for example http://stackoverflow.com/questions/4403906/is-it-possible-in-scala-to-force-the-caller-to-specify-a-type-parameter-for-a-po, in which ambiguity is used to prevent "Nothing" from being inferred as the return type of a method).

However, the compile time error for "ambiguous implicit values" is opaque and not obviously related to the constraint being enforced. There should be a @ambiguousImplicits annotation similar to @implicitNotFound that allows you to provide a user-friendly error message in the case that an implicit search for the annotated type triggers an "ambiguous implicit values" compile error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions