Skip to content

Warn if implicit underscore is no-op #11618

@som-snytt

Description

@som-snytt

Please warn on:

implicit val _ = 42
implicitly[Int]

Normally, an extractor pattern would either fail or implicit is available.

scala> object X { def unapply(s: String) = Option(s.tail) }
defined object X

scala> val X(s) = "hello"
s: String = ello

scala> val X(_) = "hello"

scala> implicit val X(_) = "hello"

scala> implicitly[String]
                 ^
       error: could not find implicit value for parameter e: String

#10384

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions