Skip to content

Spurious deprecation warning in pattern #12997

Open
@lrytz

Description

@lrytz

Spurious deprecation warning when the type of a bound value in a pattern is deprecated.

Scala 2.13.14:

scala> @deprecated class K
class K

scala> def k = Option(new K)
                          ^
       warning: class K is deprecated
def k: Option[K]

scala> def t = k match { case Some(the_k) => 0; case _ => 1 }
                              ^
       warning: class K is deprecated
def t: Int

the case Some(the_k) tree is transformed to case (value: K): Some[K]((the_k @ _)) => 0 where the (value: K): Some[K] tree is a TypeTree with a MethodType. The reference to K in there is reported by RefChecks.

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions