You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spurious deprecation warning when the type of a bound value in a pattern is deprecated.
Scala 2.13.14:
scala>@deprecated classKclassK
scala>defk=Option(newK)
^
warning: classK is deprecated
defk:Option[K]
scala>deft= k match { caseSome(the_k) =>0; case _ =>1 }
^
warning: classK is deprecated
deft: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.
The text was updated successfully, but these errors were encountered:
$ scala -deprecation
Welcome to Scala 3.4.1 (21.0.2, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala> @deprecated class K
// defined class K
scala> val k = Some(new K)
1 warning found
-- Deprecation Warning: ------------------------------------------------------------------------------------------------
1 |val k = Some(new K)
| ^
| class K is deprecated
val k: Some[K] = Some(rs$line$1$K@5e7e7a7e)
scala> k match { case Some(v) => v }
1 warning found
-- Deprecation Warning: ------------------------------------------------------------------------------------------------
1 |k match { case Some(v) => v }
| ^
| class K is deprecated
val res0: K = K@5e7e7a7e
scala>
without -deprecation the summary is
scala> val k = Some(new K)
there were 2 deprecation warnings; re-run with -deprecation for details
1 warning found
val k: Some[K] = Some(rs$line$1$K@7e1762e6)
The spec talks only about the expected type of the variable pattern. (It is not specified as a typed pattern.)
Spurious deprecation warning when the type of a bound value in a pattern is deprecated.
Scala 2.13.14:
the
case Some(the_k)
tree is transformed tocase (value: K): Some[K]((the_k @ _)) => 0
where the(value: K): Some[K]
tree is aTypeTree
with aMethodType
. The reference toK
in there is reported by RefChecks.The text was updated successfully, but these errors were encountered: