Closed lrytz closed 3 months ago
For the record, Scala 3 already warns one line earlier...
scala> @deprecated case class C(x: Int)
// defined case class C
scala> object A { type X = C; val X = C }
1 warning found
-- Deprecation Warning: --------------------------------------------------------
1 |object A { type X = C; val X = C }
| ^
| class C is deprecated
// defined object A
scala> new A.X(10) // no deprecation
val res2: C = C(10)
scala> A.X.toString // spurious deprecation
1 warning found
-- Deprecation Warning: --------------------------------------------------------
1 |A.X.toString // spurious deprecation
|^^^^^^^^^^^^
|class C is deprecated
val res3: String = C
scala> A.X.apply(10) // spurious deprecation
1 warning found
-- Deprecation Warning: --------------------------------------------------------
1 |A.X.apply(10) // spurious deprecation
|^^^^^^^^^
|class C is deprecated
val res4: C = C(10)
That must be yet another feature interaction. It's not that Scala 3 generally looks through aliases to find deprecations. type Alias = DeprecatedClass; new Alias
doesn't warn.
On 2.13.14:
The warning is actually issued while performing
transformCaseApply
, which happens during refchecks. 2.12 doesn't warn because the compiler doesn't see through the alias and doesn't trigger thetransformCaseApply
optimization.