Skip to content

implicit with singleton type works around explicit result type for implicits #3996

Closed
@olafurpg

Description

@olafurpg
object singleton {
  val x = "Hello!"
  implicit val y: x.type = x
  implicitly[String].length
}

I expected the program to be rejected because the type of x is inferred and Dotty requires an explicit result type for implicits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions